AutoComplete TextView
在布局文件中加入
<AutoCompleteTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1" //设置输入1个字符时显示自动提示
android:id="@+id/auto"/>
在res/values/string.xml中定义自动完成提示功能字符串数组资源
<resources>
<string name="app_name">name_text</string>
<string-array name="select_array">
<item>cable</item>
<item>come</item>
<item>check</item>
<item>China</item>
<item>adsd</item>
<item>武汉</item>
</string-array>
</resources>
在java文件中绑定适配器
AutoCompleteTextView auto= findViewById(R.id.auto);
String [] selects = getResources().getStringArray(R.array.select_array);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,selects);
auto.setAdapter(adapter);