通常使用res/values
文件夹中的strings.xml
文件填充AutoCompleteTextView
。谁能告诉我如何使用在类中创建的字符串数组来填充AutoCompleteTextView
发布于 2012-08-27 11:33:04
试试这个。
autocompletetextAdapter = new ArrayAdapter<String>(
this,
android.R.layout.simple_dropdown_item_1line, stringArray);
myAutocompleteTextView.setAdapter(autocompletetextAdapter);
发布于 2012-08-27 09:45:39
只需在获取数组的类中创建一个公共方法,如: getArray (),然后在自动完成文本视图中使用它
发布于 2012-08-30 02:06:23
我是这样做的:
((AutoCompleteTextView) findViewById(R.id.autoCompleteTextView1)).setAdapter(
new ArrayAdapter<String> (this, android.R.layout.simple_dropdown_item_1line,
String_array));
其中autoCompleteTextView1
是您的自动补全字段名,String_array是您想要传递的数组。
https://stackoverflow.com/questions/12139569
复制