Why is the <u> tag being added to my EditText?

79 views Asked by At

I'm typing into an EditText, and logging it like this:

mEditText.addTextChangedListener(new TextWatcher() {

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {
        Log.d(LOG_TAG, Html.toHtml(new SpannableStringBuilder(s)));
    }

    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {

    }

    @Override
    public void afterTextChanged(Editable s) {

    }
});

The LogCat output looks like this:

<p dir="ltr"><u>typing stufffff</u></p>

I'm not using an EditText subclass, and I'm not setting any custom styles.

What could be causing the <u> tag to be added?

1

There are 1 answers

3
ElectronicGeek On BEST ANSWER

That tag is a underlined tag. The EditText must be underlined. This is due to the fact that there are Text Suggestions. If you set the inputType using the TextView.setInputType(int) method, or one in a .xml file, you can get rid of the tag.