I am doing show or hide password using below code
pwdLayout.setEndIconMode(TextInputLayout.END_ICON_PASSWORD_TOGGLE);
I am able to achieve show or hide password. But eye icon with cross sign is showing password and without cross sign is hiding password. I need to reverse this logic how to do this?
<input type = "password" > Thus the entered characters are masked or hidden. To make a textbox that can hide the entered characters, the type attribute of <input> element should be set to "password."
In order to toggle the visibility of the password, one needs to follow the below-described steps: Step 1: Create an input element with a password field that will take input in the password form. Step 2: Add an icon within the input element on which the user can click to toggle the visibility of the password.
To show or hide the password in the input field in Reactjs, the basic idea is to change the input tag's type attribute to text from password and vice versa on clicking the "Show password" button or an appropriate button of your own.
Starting from the 1.2.0
this is the default behavior:
If you want to reverse the icon you can use something like:
<com.google.android.material.textfield.TextInputLayout
app:endIconDrawable="@drawable/custom_password_eye"
with:
<animated-selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="NewApi">
<item
android:id="@+id/visible"
android:drawable="@drawable/design_ic_visibility"
android:state_checked="true"/>
<item
android:id="@+id/masked"
android:drawable="@drawable/design_ic_visibility_off"/>
<transition
android:drawable="@drawable/avd_show_password"
android:fromId="@id/masked"
android:toId="@id/visible"/>
<transition
android:drawable="@drawable/avd_hide_password"
android:fromId="@id/visible"
android:toId="@id/masked"/>
</animated-selector>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With