AutoCompleteTextView showDropDown无法正常工作

时间:2014-05-29 16:17:30

标签: android autocompletetextview

我是异步加载数据,我有一个AutoCompleteTextView,当数据加载时它在适配器中设置当我点击搜索视图时我想向用户显示所有结果。我可以确认正在调用onClickListener,但结果只显示我第二次点击。

  private View.OnClickListener onAutoCompleteClickListener = new View.OnClickListener(){
   @Override
    public void onClick(View v) {
        autoCompleteTextView.setText(" ");
        searchAdapter.notifyDataSetChanged();
        autoCompleteTextView.showDropDown();
    }
};

1 个答案:

答案 0 :(得分:2)

修复了在SO

上使用this回答

基本上覆盖AutoCompleteTextView onFocusedChanged

@Override
protected void onFocusChanged(boolean focused, int direction,
                              Rect previouslyFocusedRect) {
    super.onFocusChanged(focused, direction, previouslyFocusedRect);
    if (focused) {
        performFiltering(getText(), 0);
    }
}