Android: AutoCompleteTextView show suggestions when no text entered

后端 未结 14 1935
-上瘾入骨i
-上瘾入骨i 2020-11-27 11:20

I am using AutoCompleteTextView, when the user clicks on it, I want to show suggestions even if it has no text - but setThreshold(0) works exactly

14条回答
  •  孤独总比滥情好
    2020-11-27 12:27

    The adapter does not perform filtering initially.
    When the filtering is not performed, the dropdown list is empty.
    so you might have to get the filtering going initially.

    To do so, you can invoke filter() after you finish adding the entries:

    adapter.add("a1");
    adapter.add("a2");
    adapter.add("a3");
    adapter.getFilter().filter(null);
    

提交回复
热议问题