Android Ice Cream Sandwich Edittext: Disabling Spell Check and Word Wrap Android Ice Cream Sandwich Edittext: Disabling Spell Check and Word Wrap android android

Android Ice Cream Sandwich Edittext: Disabling Spell Check and Word Wrap


Disabling Spell-Checking
In order to get rid of spell checking you must specify the EditText's InputType in the XML as the following:

android:inputType="textNoSuggestions"

However, my EditText needed also to be multiline, so I have added the following line to the EditText's XML:

android:inputType="textMultiLine|textNoSuggestions"

Disabling Word-Wrap
As noted, the XML attribute android:scrollHorizontally="true" does not work. However, strangely, if it is done through Java it does work. Here is the necessary code to achieve no word wrapping:

mEditText.setHorizontallyScrolling(true);


Disabling Spell-Checking in EditText.

In Android 4.0+ sometimes I get a red underline in my Textview so i add the property ...

android:inputType="textNoSuggestions" 

textNoSuggestions: to indicate that the IME should not show any dictionary-based word suggestions.

Here is a list of possible properties that we can define in :android:inputType

Disabling Word-Wrap

remember that the property android:scrollHorizontally="true" doesn't work, so this is the solution:

mEditText.setHorizontallyScrolling(true);


In your Java class you can add to the Edittext object...

  wire1type = (EditText)findViewById(R.id.wire1type);  wire1type.setInputType( ~(InputType.TYPE_TEXT_FLAG_AUTO_CORRECT) );

This clears out the autocorrect flag and will work in API 4.