user1689687
user1689687

Reputation: 41

Can't create an EditText with multiple lines & no spelling suggestions on 2.3.4

I've been trying for weeks and I haven't been able to get an EditText to use multiple lines and have no spelling suggestions.

I need to put in different languages, so the autocorrect definitely can't be turned on, but it seems to interfere with letting it run multiple lines.

I can get either of them to work, but not both at the same time.

I've tried:

android:inputType="textFilter|textMultiLine|textNoSuggestions"

and

.setInputType(InputType.TYPE_TEXT_VARIATION_NORMAL | InputType.TYPE_TEXT_VARIATION_FILTER | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);

and many other methods I found on Google and here at SO none have worked. Maybe it's specific to my OS version? Is this a known error?

Upvotes: 4

Views: 528

Answers (1)

Hendrik
Hendrik

Reputation: 6144

I've just tried this myself on a 2.3.4 device and for me your code is showing no suggestions:

EditText testView = new EditText(context);
testView.setInputType(InputType.TYPE_TEXT_VARIATION_NORMAL | InputType.TYPE_TEXT_VARIATION_FILTER | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
mainLayout.addView(testView);

So this issue could be specific to the device you are testing on.

However you could try using setRawInputType() instead of setInputType().

You could also try using the flag InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD which should not display any suggestions whatsoever:

testView.setRawInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);

Upvotes: 4

Related Questions