how to invert password eye icon?

Issue

enter image description here

the above eye icon in the edit text showing in reverse order when typing password, the password eye icon is blind when the password is invisible. how to invert it

thanks,

<android.support.design.widget.TextInputLayout
android:id"@+id/layout_password"
android:layout_width"match_parent"
android:layout_height"wrap_content"
app:passwordToggleEnabled"true"
app:passwordToggleTint"#000000">

<EditText
android:layout_width"match_parent"
android:layout_height"wrap_content"
android:id"@+id/password"
android:hint"@string/password"
android:inputType"textPassword"/>
</android.support.design.widget.TextInputLayout>

Solution

you must take two drawable in and then Change drawable image dynamically on button click or any other event like below you may set drawable in EditText like below:

Drawable img  getContext().getResources().getDrawable( R.drawable.smiley );
editText.setCompoundDrawablesWithIntrinsicBounds( null, null, img, null);

Answered By – Chetan Joshi

Leave a Comment