2011-04-25
11:00:04
AutoCompleteTextView 是Android中輸入提示框 雖然現在的輸入法越來越強大,但還是讓用戶輸入越方便越好
下面來看看代碼
1.在main.xml中創建一個 AutoCompleteTextView 佈局
2.爲 AutoCompleteTextView 中的數據提供佈局res/item_list.xml
3.AutoCompleteText.java
在 ArrayAdapter中爲AutoCompleteTextView提供數據源的另一種方法是在string.xml中添加string-array 如
獲取數據
String[] countries = getResources.getStringArray(R.array.countr);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,R.layout.item_list ,country
);