Show all items in AutocompleteTextView without writing text

前端 未结 12 798
萌比男神i
萌比男神i 2020-12-29 01:05

I have a AutocompleteTextView and it works fine. When I write a word it shows the relevant result but I want to show all items without writing any word in AutocompleteTextVi

12条回答
  •  执笔经年
    2020-12-29 01:42

    you need to put those steps to make it work perfectly

    1-in your xml put this

        
    

    you just need to set android:completionThreshold to zero

    2- in your java code put

      mViewDataBinding.accountTypeSpinner.setOnFocusChangeListener((v, hasFocus) -> {
            if (hasFocus)
                mViewDataBinding.accountTypeSpinner.showDropDown();
        });
    

提交回复
热议问题