Search code examples
androidcolorsstylesexpandablelistview

How to change color of arrow of expandableListView?


How to change the color of the drop-down arrow of an expandable ListView?

It would be better to just change color with, so animation isn't lost.


Solution

  • Unfortunately everything I've seen says that you need to use a custom drawable, like so

    <ExpandableListView 
        android:id="@+id/expandableList"
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent"
        android:groupIndicator="@drawable/custom_expandable" />
    

    Then in custom_expandable.xml

    <selector xmlns:android="http://schemas.android.com/apk/res/android">
        <item android:drawable="@drawable/up_arrow" 
            android:state_empty="true" />
        <item android:drawable="@drawable/down_arrow" 
            android:state_expanded="true" />
    </selector>