Compound Drawable And Seterror Problematic
Im using this library: https://github.com/lisawray/passwordview to toggle password on/off. Im also using setError when the password is false. It works from start. I enter a false p
Solution 1:
You can make this work if you override the setError()
method in your custom EditText
implementation and remove the compound drawable on the right, before calling super.setError()
. Also don't forget to set it back afterwards.
Example:
@OverridepublicvoidsetError(CharSequence error, Drawable icon) {
Drawable[] drawables = getCompoundDrawables();
setCompoundDrawables(drawables[0], drawables[1], null, drawables[3]);
super.setError(error, icon);
setCompoundDrawables(drawables[0], drawables[1], drawables[2], drawables[3]);
}
This way the right drawable will still be able to toggle after the error disappears.
Post a Comment for "Compound Drawable And Seterror Problematic"