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

While testing on Android Emulator running Android 4.0 (Ice Cream Sandwich), I noticed that Edittext does pretty strange things.

Firstly, it emphasizes every word designated as โ€œtypoโ€ in red. How do I disable this? Secondly, although the inclusion of word wrapping android:scrollHorizontally="true" is turned on in the XML layout I specified, how can I turn it off too? Here is the layout XML for the edit text:

  <EditText android:id="@+id/editor" android:layout_width="40dp" android:layout_height="fill_parent" android:layout_alignParentRight="true" android:layout_below="@+id/toolbar" android:layout_toRightOf="@+id/toolbarleft" android:paddingBottom="0dp" android:paddingRight="0dp" android:scrollHorizontally="true" android:text="" android:inputType="textMultiLine" > <requestFocus /> </Edittext> 

Here is an example of spell checking that I need to disable:

Demonstration of Spell-Checker
(source: abstract-oughtts.com )

Thank you very much!

+43
android android-edittext spell-checking word-wrap android-4.0-ice-cream-sandwich
Jan 25 '12 at 23:24
source share
7 answers

Turn off spell checking
To get rid of spellchecking, you must specify EditText InputType in XML as follows:

android:inputType="textNoSuggestions"

However, my EditText should also be multi-line, so I added the following line to the EditText XML file:

android:inputType="textMultiLine|textNoSuggestions"

Disabling Word-Wrap
As already noted, the XML attribute android:scrollHorizontally="true" does not work. However, oddly enough, if this is done through Java, it really works. Here is the code you need to prevent word wrap:

mEditText.setHorizontallyScrolling(true);

+87
Aug 18 '12 at 22:17
source share

Disable spell checking in EditText.

In Android 4.0+ sometimes I get a red underline in my text view, so I add a property ...

 android:inputType="textNoSuggestions" 

textNoSuggestions : to indicate that the IME should not show any dictionary sentences of words.

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

Disabling Word-Wrap

remember that the android:scrollHorizontally="true" property does not work, so this solution:

 mEditText.setHorizontallyScrolling(true); 
+34
Feb 22 '12 at 17:32
source share

In your Java class, you can add an Edittext object ...

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

This clears the AutoCorrect flag and will work in API 4.

+9
Apr 24 2018-12-12T00:
source share
 android:inputType="textMultiLine|textPhonetic" 

removed all red underscores for me.

 android:inputType="textMultiLine|textNoSuggestions" 

creates a compilation error.

I am using Android API 1.6.

+7
Apr 27 2018-12-12T00:
source share

Disabling spell checking for general text input by code:

 mEditText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); 
+5
May 22 '13 at 5:46
source share

remove android:inputType="" and everything should be fine.

0
Jan 26 2018-12-12T00:
source share

To disable line wrapping, you must wrap (no pun intended) your EditText using HorizontalScrollView and set layout_width to match_parent.

0
Feb 14 2018-12-12T00:
source share



All Articles