EditText error icon and password displayed

I have an EditText as a password input such as

<android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText android:id="@+id/password" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/prompt_password" android:imeActionId="@+id/login" android:imeActionLabel="@string/action_sign_in_short" android:imeOptions="actionUnspecified" android:inputType="textPassword" android:maxLines="1" android:singleLine="true" /> </android.support.design.widget.TextInputLayout> 

It works, but on error, the shwon error icon appears twice, and it appears on top of the password icon.

error icon with error

My verification code to show the error:

 if (success) { finish(); startMainActivity(); } else { mPasswordView.setError(getString(R.string.error_incorrect_password)); mPasswordView.requestFocus(); } 
+5
source share
2 answers

Do not call setError in EditText , use TextInputLayout setError ()

+17
source

This seems to be a bug after updating gradle dependencies to 24+. Check out this answer. Before that, I had everything setError() . In addition, you do not have to require focus to display an error.

-1
source

All Articles