对不起,我是新手
请帮助如何在所有单词中使用一个链接来使用AutoCompleteTextView任何建议?
示例:
答案 0 :(得分:0)
AutoCompleteTextView actv =(AutoCompleteTextView)findViewById(R.id.autocomplete_textview);
String[] values = new String[] { "Android", "iPhone", "WindowsMobile",
"Blackberry", "WebOS", "Ubuntu", "Windows7" };
ArrayList<String> list = new ArrayList<String>();
for (int i = 0; i < values.length; ++i) {
list.add(values[i]);
}
final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, list);
actv.setAdapter(adapter);
actv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Toast.makeText(MainActivity.this,
adapter.getItem(position).toString(),
Toast.LENGTH_SHORT).show();
}
});