Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

disable "spell checking" on textView

This is more a 'is there a more appropriate way' question as I have found a work around.

Some of my table headers are being picked up as spelling errors and underlined in red. Of course, that is not what I would like to see. I have found that using

android:inputType="textNoSuggestions"

does disable the spell check markings. I find it odd (bug?) that this is necessary as the docs state:

inputType: The type of data being placed in a text field, used to help an input method decide how to let the user enter text.

and there is no input associated with just textView. So is this the only/more appropriate way of avoiding the spell check and also, is this a bug that it is spell checking non-input fields?

UPDATE: per request this is sample xml

<TextView
        android:text="ID#"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:typeface="monospace"
        android:textSize="14sp"
        android:digits="4"
        android:textAlignment="gravity"
        android:layout_weight="5"
        android:gravity="left"
        android:singleLine="true"
        android:phoneNumber="true"
        android:inputType="textNoSuggestions|none">

</TextView>
like image 677
TrustNoOne Avatar asked Oct 28 '13 18:10

TrustNoOne


2 Answers

First, I would try removing the android:digits, android:phoneNumber, and android:inputType attributes.

All of those are more intended for use with fields that allow input (such as EditTexts). It also doesn't look like you are using the android:digits attribute correctly, as the string you provide defines the only allowable characters.

In essence, this combination of attributes is telling Android that your TextView accepts input in the form of telephone numbers that contain only the number 4, that this TextView doesn't accept input of any type, and Android should not provide spellcheck suggestions.

If you are setting the content of the TextView yourself, there really is no reason to try to restrict the content of the TextView with flags such as android:phoneNumber since you are the one controlling that.

like image 152
Bryan Herbst Avatar answered Nov 09 '22 06:11

Bryan Herbst


I know this is an old thread but removing the following from content XML worked for me:

    android:autoText="true"
like image 23
Adam Avatar answered Nov 09 '22 04:11

Adam