custom_email_icon.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true"
android:drawable="@drawable/ic_email_focused"/>
<item android:state_focused="false"
android:drawable="@drawable/ic_email"/>
</selector>
activity_main.xml
<EditText
android:id="@+id/emailText"
android:layout_width="301dp"
android:layout_height="48dp"
android:layout_marginTop="100dp"
android:ems="10"
android:background="@drawable/custom_input"
android:drawableStart="@drawable/custom_email_icon"
android:drawablePadding="12dp"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:hint="Email Address"
android:inputType="textPersonName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
Icon color change not working when I clicked to text. Same problem with the password line.
2
Answers
All problem is this code line, I just removed it and fixed; idk why automatically its cames when I add vector.
Instead of a focused state, you can add a selector for a pressed and selected state like following