EditText without auto-correction, etc

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".


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


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);

Try this:

android:inputType="textFilter"

If that doesn't work, try:

android:inputType="textFilter|textNoSuggestions"

Tags:

Android