AutoCompleteTextView 控件是一个具有自动完成功能的TextView。换句话说,当用户在TextView中键入内容时,该控件可以显示建议输入的内容。
代码如下:
<AutoCompleteTextView
android:id="@+id/auto"
android:layout_width="fill_parent"
android:layout_height="wrap_parent"/>
主代码中内容如下:
AutoCompleteTextView auto = (AutoCompleteTextView)findViewById(R.id.auto);
ArrayAdapter<String> aa = new ArrayAdapter<String>(this,
android.R.layout.simple_dropdown_item_line,
new String[]{"English", "yuwen", "shuxue"});
auto.setAdapter(aa);
以上代码只是很简单,一些布局什么的都没有写,相信只要学过android的都能
看得懂的。。