7

I have many layouts in my app that use TextView to display some sentence fetched from back-end. The problem is, sometimes the text to be displayed contains some words which are not in the english dictionary, so I get a red underline beneath those words. This looks very bad. I have seen other SO posts regarding the same and people suggested to use :

android:inputType="textNoSuggestion"

in the xml of TextView. But, I get a warning from Android Studio that inputType should only be used for EditText or other similar views for input and I guess it is correct.

So, is there any TextView specific attribute that I can use for disabling the spell check? Is there any global setting I can put in the app that disables spell checking, because to refactor each TextView with some attribute seems a lot of work.

Amit Tiwari
  • 3,684
  • 6
  • 33
  • 75
  • So does this happen when you actually run on a device? – Ruchira Randana Mar 15 '16 at 09:14
  • @RuchiraRandana yes, it happens on many devices. – Amit Tiwari Mar 15 '16 at 09:22
  • remove this if added or set it to false – Developine Mar 15 '16 at 09:30
  • android:autoText="true" – Developine Mar 15 '16 at 09:30
  • @HammadTariqSahi I am not using that attribute anywhere. – Amit Tiwari Mar 15 '16 at 09:32
  • Have you tried using `android:inputType="none"` ? I tried it out and it doesn't seem to give a warning like the android:inputType="textNoSuggestion". Let me know if it works, can't really verify on my end since the ***red lines*** on `TextView`s hasn't appeared on my emulator yet. I'll post it as answer if it does. – AL. Mar 23 '16 at 05:47
  • Have you solved this problem??? I also have that problem. But I guess some specific keyboard app do the spell checking. Some of my phones which have different keyboard app don't check anything, so no underline. But I'd like to just disable spell check so that it is not gonna happen in all the devices – c-an Jun 30 '18 at 08:24

4 Answers4

4

Okay, I had the same problem and found out the solution. Add this attribute to your TextView.

android:inputType="textFilter"

if this attribute already set to text then, change it.

Here is my reference: Turn off autosuggest for EditText?

c-an
  • 3,543
  • 5
  • 35
  • 82
1

Try using android:inputType="textVisiblePassword"

IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
maveroid
  • 1,840
  • 1
  • 20
  • 20
  • I guess this attribute is used on passwords fields when you want to have the option of showing the password to user. It has no relation to what I asked. – Amit Tiwari Mar 15 '16 at 09:24
  • Please refer to 3rd answer at http://stackoverflow.com/questions/1959576/turn-off-autosuggest-for-edittext – maveroid Mar 15 '16 at 09:28
  • Since EditText extends TextView, this should work on TextView as well... Please try it in your code once and let me know.. – maveroid Mar 15 '16 at 09:32
0

Try this :

android:autoText="true"
Garg
  • 2,731
  • 2
  • 36
  • 47
0

Try this

android:inputType="textNoSuggestions"