Turn off autosuggest for EditText?

2019-01-02 23:07发布

Is there a way to programmatically turn off that autosuggest list which pops up as you type in EditText?

11条回答
三岁会撩人
2楼-- · 2019-01-02 23:45

OK, the problem was - in Eclipse you don't get suggestion for flag named: textNoSuggestion

And you can't set it in main.xml (where you design UI) because that attribute for inputType isn't recognized. So you can set it in code using int const:

EditText txtTypeIt = (EditText) this.findViewById(R.id.txtTypeIt);
txtTypeIt.setInputType(524288);

And thanks jasta00 for helping me out figure answer for this one.

查看更多
The star\"
3楼-- · 2019-01-02 23:48

I was getting this thing on samsung phones running 4.4.4. This solved my problem

android:inputType="text|textVisiblePassword|textNoSuggestions"
查看更多
狗以群分
4楼-- · 2019-01-02 23:50
android:inputType="textVisiblePassword" 

works like a charm

查看更多
叛逆
5楼-- · 2019-01-02 23:53
  1. Programatically

    edittext.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    
  2. XML

    android:inputType="textNoSuggestions|textVisiblePassword"
    
查看更多
对你真心纯属浪费
6楼-- · 2019-01-02 23:58

As this is still an issue, I'm going to post this answer. android:inputType="textVisiblePassword" works but it is undesirable, first because it's a misrepresentation of the input and second because it disables Gesture Typing!

Instead I had to use BOTH flags textNoSuggestions and textFilter. Either one alone did not work.

android:inputType="textCapSentences|textFilter|textNoSuggestions"

The textCapSentences was for other reasons. But this inputType kept the swipe typing and disabled the suggestion toolbar.

查看更多
SAY GOODBYE
7楼-- · 2019-01-02 23:58
android:inputType="text|textNoSuggestions"
查看更多
登录 后发表回答