Example 1
Directly designated Android:entries, it is relatively simple, but the general selection box is enough
Items.xml
<?XML version= "1.0" encoding= "Utf-8"?><Resources> <String-arrayname= "Ys"> <Item>Red</Item> <Item>Green</Item> <Item>Yellow</Item> </String-array></Resources>
View Code
Activity_main.xml
<Relativelayoutxmlns: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"Tools:context= "${relativepackage}.${activityclass}" > <SpinnerAndroid:id= "@+id/spinner1"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:layout_alignparentleft= "true"Android:layout_alignparenttop= "true"android:entries= "@array/ys" /></Relativelayout>View Code
Example 2
Android Learning-Interface-ui-spinner