I need to change color of the password toggle in TextInputLayout
if EditText
is focused or not. I've done it this way but it's not working. The color is always equals color light grey (from state focused = false)
layout
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:passwordToggleEnabled="true"
app:passwordToggleDrawable="@drawable/password_toggle_selector"
app:passwordToggleTint="@color/color_password_toggle">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
color_password_toggle
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/color_green" android:state_checked="true" />
<item android:color="@color/color_grey" android:state_focused="true" />
<item android:color="@color/color_light_grey" android:state_focused="false" />
password_toggle_selector
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_eye" android:state_checked="true />
<item android:drawable="@drawable/ic_eye_off" />