Combine the Autocompletetextview with a button to make a drop-down box that you can enter or select.
The following is a definition of the XML file, Auto_spinner.xml:
1<?xml version= "1.0" encoding= "Utf-8"?>2<linearlayout xmlns:android= "Http://schemas.android.com/apk/res/android"3Xmlns:tools= "Http://schemas.android.com/tools"4Android:layout_width= "Fill_parent"5android:layout_height= "50dip"6android:background= "@android:d rawable/edit_text"7android:paddingright= "10dip"8android:weightsum= "4" >9 Ten<Autocompletetextview OneAndroid:id= "@+id/repeatemode" AAndroid:layout_width= "0dip" -android:layout_height= "Fill_parent" -android:layout_weight= "3" theAndroid:background= "@null" -Android:cachecolorhint= "#00000000" -android:completionthreshold= "1" -android:dropdownhorizontaloffset= "20DP" +Android:ems= "10" -android:gravity= "Center_vertical" > + A<requestfocus/> at</AutoCompleteTextView> - -<ImageButton -Android:id= "@+id/repeatemodebtn" -Android:layout_width= "0DP" -android:layout_height= "Fill_parent" inAndroid:layout_weight= "1.0" -android:src= "@android:d rawable/btn_dropdown" to/> + -</LinearLayout>
This is part of the code:
...Private voidinit (Context context) {//This.context = context;Layoutinflater.from (context). Inflate (R.layout.auto_spinner, This); Adapter=NewArrayadapter<string>(Context, Android.) R.layout.simple_dropdown_item_1line, list); Text= (Autocompletetextview) This. Findviewbyid (R.id.repeatemode); Text.setadapter (adapter); Button= (ImageButton) This. Findviewbyid (R.ID.REPEATEMODEBTN); Button.setonclicklistener (NewOnclicklistener () {@Override Public voidOnClick (View v) {//Show drop-down boxText.showdropdown (); } }); }
So basically a few can.