Change the expandable list view android icon

2


I want to change the icon of the first image with that of the second image. How can I do it?

        android:id="@+id/expandableListView"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:indicatorLeft="?android:drawableLeft"
        android:divider="@android:color/darker_gray"
        android:dividerHeight="0.5dp" />
    
asked by jonatan diaz 04.06.2018 в 16:39
source

1 answer

1

For this you can use the setGroupIndicator method () , where you assign the Drawable that will be used as an indicator.

For example, assuming you have an image called "arrow" in your resources, you get the Drawable and assign it as an icon to your ExpandableListView :

Drawable myIcon = getResources().getDrawable( R.drawable.flecha );
expandableListView.setGroupIndicator(myIcon);
    
answered by 04.06.2018 / 17:37
source