EditText without auto-correction, etc

Android

Android Problem Overview


My EditText needs to accept input consisting of partial words, names, etc. At least on my HTC Desire, this is difficult since the keyboard wants to suggest and/or correct some entries (e.g., changes "gor" to "for"). I tried setting textNoSuggestions on the view, but that doesn't fix it.

Any simple solution to this?

Android Solutions


Solution 1 - Android

Try this:

android:inputType="textFilter"

If that doesn't work, try:

android:inputType="textFilter|textNoSuggestions"

Solution 2 - Android

You can do this from the code. Set the input type of the EditText like below:

txtEmail = (EditText) findViewById(R.id.txtEmail);
txtEmail.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);

For a list of all the available input type options see http://developer.android.com/reference/android/text/InputType.html

Solution 3 - Android

The other suggestions are correct, but SwiftKey has decided it will ignore the inputtype values "in response to user requests". While I agree this is a bad idea since it contradicts the Google guidelines and developers usually have a good reason for disabling auto-correction (like username fields, family names and so on), it still is the most used keyboard application for Android devices, so this can be a big problem.

The workaround is to use either

android:inputType="textVisiblePassword"

or

.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);

Solution 4 - Android

Try this if you want a multi-line EditText without displaying the underlines (auto correct):

    myEditText.setInputType(InputType.TYPE_CLASS_TEXT | 
       InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);

Here's XML for that: android:inputType="textNoSuggestions|textMultiLine".

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiongordonwdView Question on Stackoverflow
Solution 1 - AndroidmagicmanView Answer on Stackoverflow
Solution 2 - AndroidZaki ChoudhuryView Answer on Stackoverflow
Solution 3 - AndroidVlad SchnakovszkiView Answer on Stackoverflow
Solution 4 - Androidlive-loveView Answer on Stackoverflow