Spinner
==>
Spinner is an indirect subclass of ViewGroup and therefore can also be used as a container.
Common Properties:
android:prompt--Set the list box selection box's prompt information
android:entries--sets the list item for the drop-down list box for the array resource
Note: When using spinner, if you can pre-instruct the contents of the ListBox, you do not need to write code, just specify the Android:entries property for spinner to implement a drop-down list box.
Example one: The simplest way to use
<?xml version= "1.0" encoding= "Utf-8"?><resources> < String-array name= "Books" > <item> big Talk design mode </item> <item> Big android</item> < Item>java Advanced Programming </item> </string-array></resources><relativelayout xmlns:android= "/http Schemas.android.com/apk/res/android "xmlns:tools=" Http://schemas.android.com/tools "android:layout_width=" Match_ Parent "android:layout_height=" match_parent "android:paddingbottom=" @dimen/activity_vertical_margin "Android:padd ingleft= "@dimen/activity_horizontal_margin" android:paddingright= "@dimen/activity_horizontal_margin" Android: paddingtop= "@dimen/activity_vertical_margin" tools:context= ". Indexactivity "> <spinner android:id=" @+id/spcontent "android:entries=" @array/books "Android : layout_width= "match_parent" android:layout_height= "wrap_content"/></RELATIVELAYOUT>
Note: You need to add the Arrays.xml file to the values folder, such as:
Note: You can add spinner Select events by handling Setonitemselectedlistener ...
Example Two
Android Learning Note Six--spinner