AutoCompleteTextView hides auto suggestions

I have an AutoCompleteTextView widget on a view. if it has input focus, and I try to change the text there:

txtField1.setText("test"); 

A list of offers appears on the screen. How to hide it? Is it possible to update text that does not display sentences?

+7
source share
2 answers

I suggest some methods

1) If you want to do a β€œtest” as a textView autocomplete hint, then do it,

  txtField1.setHint("test"); 

2) If you need to fill out the text representation of "test", and also not allow the sentence to increase the threshold level for automatic completion of text viewing,

  txtField1.setThreshold(5); 

if you use a threshold, it will show a sentence after 5 characters (according to the code indicated in the line above). If you need to try to set another word, and also try to avoid the sentence, change the threshold dynamically based on the length of the string.

+1
source

I will leave it here if someone needs it in the future, as I do.

 yourAutoCompleteTextView.dismissDropDown(); 

will cause the list of offers to disappear from the screen.

+27
source

All Articles