0

I have 2 editTexts in my project namely usernameField and passwordField. The usernameField has a android:drawableStart="@drawable/custom_username_field" which sets the start of the EditText to custom_username_field in which the custom_username_field has the following XML code

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_focused="false"
        android:drawable="@drawable/ic_user_icon"/>

    <item android:state_focused="true"
        android:drawable="@drawable/ic_user_icon_focused"/>

</selector>

its pretty straight forward. if it is focused then it will use @drawable/ic_user_icon_focused if not then it will use @drawable/ic_user_icon

but the problem is that when I start the app, it uses the focused icon for the username field instead of the default one and if I change the focus to passwordField then the usernameField's icon changes to ic_user_icon and the passwordField, which has the same code as the usernameField, changes to the focused one but if I do not focus on the passwordField it still has the focused icon.

I know that this might not be a valid problem to post on stack overflow but it's a problem that I can't seem to find a solution to.

Dr Mido
  • 2,414
  • 4
  • 32
  • 72
Blek Bomor
  • 39
  • 5

0 Answers0