Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove Android auto-suggest underlining in EditText?

I'm using an EditText to write some text. Android's auto-suggest underlines the word, until we hit space. Now, if I enter the word without the space, the resulting text has an underline. It's because I use Html.toHtml(view.getText()).

Now, there are a few answers I'll be expecting such as disabling auto-suggestion or using view.getText().toString(), but I need them both. I need the auto-suggestion feature as well as the formatting of the text. An example which solves this problem is the Gmail app. You can write whatever you want in the EditText box and it sends the email without the words being underlined.

like image 232
addybist Avatar asked Jun 23 '15 00:06

addybist


People also ask

How do I stop my Android from underlining?

Originally Answered: How do I remove the underline feature while typing in Android keyboard ? Goto settings > Language & input > Android Keyboard settings > auto correction > off.

How do I stop underlining text?

The quickest way to underline text is to press Ctrl+U and start typing. When you want to stop underlining, press Ctrl+U again. You can also underline text and spaces in several other ways.

What is the difference between edit text and TextView Android?

EditText is used for user input. TextView is used to display text and is not editable by the user. TextView can be updated programatically at any time.


1 Answers

Use this just before you getText(). This is the most straightforward and the official way.

 edittext.clearComposingText();
like image 200
SadeepDarshana Avatar answered Sep 17 '22 12:09

SadeepDarshana