ダイアログポップアップはhereです。AutoCompleteTextViewドロップダウンの高さがダイアログポップアップで制限されます
ポップアップビューの最後でオートコンプリートの結果がどのように停止するかは、hereです。
結果をダイアログビューから親ビューにドロップしたいとします。私がそれをすることができない場合、私はオートコンプリートが私に2つを与える結果の数を制限したい。
これは私のクリックリスナーのポップアップメニューです。あなたがArrayAdapter
のgetCount()
を上書きすることができます:
@Override
public int getCount() {
return Math.min(2,super.getCount());
}
これはまた、フィルタリングのために働くの項目の一部の制限数については
addDialog.setContentView(R.layout.shoppinglistadd);
/**Capture the AutoCompleteTextView widget*/
final AutoCompleteTextView autoCompleteTV
= (AutoCompleteTextView) addDialog.findViewById(R.id.productEnteredShop);
/**Fills the autocomplete with possibilities*/
String[] acArray = getResources().getStringArray(R.array.completeFoodsList);
/**Create a new ArrayAdapter and bind shoppinglistitem.xml to each list item*/
ArrayAdapter<String> autoCompleteAdapter
= new ArrayAdapter<String>(ShoppingList.this, R.layout.shoppinglistitem, acArray);
/**Associate the adapter with textView*/
autoCompleteTV.setAdapter(autoCompleteAdapter);
私はもっと明確にすべきでした。私は結果の総数を2に制限するつもりはありません。残りのスクロールで一度に表示される結果の最大量を2に制限しようとしています。 –
これは彼が求めていたものではありません。これは結果の数を制限するだけです。 –