Turn off autosuggest for EditText?
I had the same question but I still wanted to set this option in my XML file so I did a little more research until I found it out myself.
Add this line into your EditText.
android:inputType="textFilter"
Here is a Tip. Use this line if you want to be able to use the "enter" key.
android:inputType="textFilter|textMultiLine"
android:inputType="textNoSuggestions"
also you'd better read this
android:inputType="textVisiblePassword"
works like a charm
Ways to do it:
- Programatically
editText.inputType = InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
- XML
android:inputType="textNoSuggestions"
If you already have some flags set, then:
- Programatically
inputType = if (disableSuggestions) {
InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS or inputType
} else {
inputType and InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS.inv()
}
- XML
android:inputType="textNoSuggestions|textPassword"