EditText error icon and show password missplaced
Same behavior for material version 1.1.0-alpha10, even if you set an error into TextInputLayout. You can avoid it by adding to the TextInputLayout this line :
app:errorIconDrawable="@null"
Don't call setError
on the EditText
, use TextInputLayout
's setError()
please add these two lines in edittext
android:layout_marginEnd="9dp"
android:paddingRight="40dp"
With this code, you can remove toggle while showing the error. you can show toggle while user writing anything. Don't remember, you should give id to text input layout
public void showError(){
password.setError(errorMessage);
password.requestFocus();
textInputLayout.setPasswordVisibilityToggleEnabled(false);
}
password.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
textInputLayout.setPasswordVisibilityToggleEnabled(true);
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void afterTextChanged(Editable editable) {
}
});