AutoCommpleteText
一、AutoCompleteText
Main.xml
<AutoCompleteTextView
android:id="@+id/actv1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
Activity代码
setContentView(R.layout.main);
actv1=(AutoCompleteTextView)findViewById(R.id.actv1);
String[] list={"hi","home","hello"};
ArrayAdapter<String> ada=new ArrayAdapter<String>(this,R.layout.item, list);
actv1.setAdapter(ada);
Item.xml代码
<?xml version="1.0" encoding="utf-8"?>
<!--此处不能加LinearLayou标签,否则会出错-->
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>