The introduction of Android User Interface (UI) Spinner

Android Spinner (Source Google Images)

Spinner lets you select an item from the drop down menu.



Spinner Syntax Application examples in class java:

// Spinner element
Spinner spinner = (Spinner) findViewById(R.id.spinner);
       
// Spinner click listener
spinner.setOnItemSelectedListener(this);

Spinner Syntax Sample Application on the layout (xml):

<Spinner
       android:id="@+id/spinner"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:prompt="@string/spinner_title"
   />

1- Create an ArrayList Item
2- Create item ArrayAdapter & Bind

Source: Master Android (App)

Post Author: Study