在输入框中输入我们想要输入的信息就会出现其他与其相关的提示信息,这种效果在Android中是用AutoCompleteTextView实现的。
public class MainActivity extends Activity { private AutoCompleteTextView autotext; private ArrayAdapter<String> arrayAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.test); autotext =(AutoCompleteTextView) findViewById(R.id.autotext); String [] arr={"aa","aab","aac"}; arrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,arr); autotext.setAdapter(arrayAdapter); } }
参考:http://www.cnblogs.com/tinyphp/p/3973358.html
http://blog.csdn.net/iamkila/article/details/7230160