在我的应用程序中,我必须在单击Textbox时显示所有列表项。
我尝试AutoCompleteTextView
不输入文本,但无法正常工作。
Android中是否还有其他小部件可以实现此目的?
请给我建议。
谢谢,
<AutoCompleteTextView
android:id="@+id/autoCompleteTextView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="65dp"
android:ems="10" >
private AutoCompleteTextView actv;
actv = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView1);
String[] xyzvalues= getResources().
getStringArray(R.array.list_of_xyzvalues);
ArrayAdapter adapter = new ArrayAdapter
(this,android.R.layout.simple_list_item_1,xyzvalues);
actv.setAdapter(adapter);
尝试在我的机器上工作。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句