Change the tint of the compoundDrawable right of EditText based on focus states

Viewed 748

I have been trying to figure out how to change the tint of a compoundDrawable of an EditText for some time with no success. I am using the EditText as a button and would like to change the color of the drawable right like the EditText underline color. How do I add a drawable state to the compoundDrawables?

I would like to tint the drawable like the underline tint when clicked.

Here is my styles.

<style name="EditTextDropdown" parent="@android:style/Widget.EditText">
    <item name="android:clickable">true</item>
    <item name="android:fontFamily">sans-serif</item>
    <item name="android:focusable">false</item>
    <item name="android:focusableInTouchMode">true</item>
    <item name="android:singleLine">true</item>
    <item name="android:cursorVisible">false</item>
    <item name="android:layout_marginLeft">16dp</item>
    <item name="android:layout_marginRight">16dp</item>
    <item name="android:drawableRight">@drawable/ic_drop_down_arrow_24dp</item>
</style>

EditText

<EditText
    android:id="@+id/phone"
    style="@style/EditTextDropdown"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="Add phone" />

Here is what it looks like normal

Normal

Here is what it looks like when pressed

Pressed

1 Answers
Related