I want to change/display different icons for show password in android edittext. I am using following code to display icon.
<android.support.design.widget.TextInputLayout
android:id="@+id/layoutTextInput"
android:textColorHint="@color/aluminium">
<android.support.v7.widget.AppCompatEditText
android:id="@+id/editTextValue"
android:imeOptions="actionNext"
android:layout_marginBottom="8dp"
android:inputType="text"/>
</android.support.design.widget.TextInputLayout>
I want to use custom icons instead of normal icons(eye-icon). Please help me.
Use
app:passwordToggleDrawable
to change the icon. Useapp:passwordToggleTint
to change the color of the icon, this will only work if the icon is a vector drawable.If you would like to use default eye icon (show/hide password) but change the icon color then you simply put the line
If you would like to use custom eye icon, you should use
to change the icon. and use
to change the color of the icon. your custom icon color does not show. Tint color will be shown. The whole xml code like below:
and show_password_selector.xml is given below:
Hope that will help all.