how to disable spellcheck Android edittext

后端 未结 6 1456
暗喜
暗喜 2020-12-13 01:33

I want to remove the underlines from texts inside edittext fields. \"text

相关标签:
6条回答
  • 2020-12-13 02:15

    Or if you want to just disable the red underline (and the autocorrect dialog), you can override the isSuggestionsEnabled() method on TextView.

    This will keep the keyboard autocomplete working.

    0 讨论(0)
  • 2020-12-13 02:18

    You can do it with following code. Just paste it in layout of EditText.

    android:inputType="textNoSuggestions"
    
    0 讨论(0)
  • 2020-12-13 02:25

    In order to get rid of spell checking you have to specify the EditText's InputType in the XML as the following:

    android:inputType="textNoSuggestions"
    

    However, if your EditText is multiline and also you need to get rid of spell checking,then you have to specify the EditText's InputType in the XML as the following:

    android:inputType="textMultiLine|textNoSuggestions"
    
    0 讨论(0)
  • 2020-12-13 02:26

    So I was not able to find out any direct way of doing it. So went ahead with below workaround:

    editText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
    

    As the input type becomes a visible password, even if the spell check is enabled from the device settings, the Red underline won't appear. :)

    0 讨论(0)
  • 2020-12-13 02:33

    I just Added a line in for EditText editText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);

    and it worked fine for me.

    0 讨论(0)
  • 2020-12-13 02:35

    Minor addition to Chintan's answer - such (and other) combination is also allowed:
    android:inputType="textCapSentences|textNoSuggestions"

    0 讨论(0)
提交回复
热议问题