Android: AutoCompleteTextView show suggestions when no text entered

后端 未结 14 1900
-上瘾入骨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:02

    Easiest way:

    Just use setOnTouchListener and showDropDown()

    AutoCompleteTextView text;
    .....
    .....
    text.setOnTouchListener(new View.OnTouchListener(){
       @Override
       public boolean onTouch(View v, MotionEvent event){
          text.showDropDown();
          return false;
       }
    });
    

提交回复
热议问题