Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Double exclamation mark on EditText setError when used on a password type field

In my application I use the Design Support Library's TextInputLayout around all my EditTexts that require the hint to label effect. However I noticed an adverse effect of doing so - applying it to a password field will make the setError method apply two exclamation marks: one in the middle of the EditText and one at the proper place, slightly covering the "eye" (password visibility) icon.

enter image description here

This only happens on fields that have the inputType set to textPassword.

How could I fix this?

EDIT:

XML layout

<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
     <EditText
        android:id="@+id/loginEmail"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/hint_email"
        android:inputType="textEmailAddress"/>            
</android.support.design.widget.TextInputLayout>

<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <EditText
        android:id="@+id/loginPassword"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/hint_password"
        android:inputType="textPassword"/>
</android.support.design.widget.TextInputLayout>
like image 435
fonix232 Avatar asked Aug 22 '16 12:08

fonix232


1 Answers

try to set your error message just for TextInputLayout and remove it from editText object.

like image 127
Saeed Halawani Avatar answered Oct 21 '22 09:10

Saeed Halawani