2012-08-27 13 views

回答

8

試試這個類的getArray()...

autocompletetextAdapter = new ArrayAdapter<String>(
         this, 
         android.R.layout.simple_dropdown_item_1line, stringArray); 

myAutocompleteTextView.setAdapter(autocompletetextAdapter); 
+0

爲什麼沒有人回覆了這個問題? –

0

只需創建一個公共方法,如:在獲得陣列,那麼你用它來與您自動完成的TextView

0

我做到了這種方式:

((AutoCompleteTextView) findViewById(R.id.autoCompleteTextView1)).setAdapter(
    new ArrayAdapter<String> (this, android.R.layout.simple_dropdown_item_1line, 
     String_array)); 

其中autoCompleteTextView1是你的Autocompletetextview字段名String_array是你想傳遞的數組。

相關問題