How to set group divider color for ExpandableListView

10,530

Solution 1

The color of the divider line when a group is closed can be set via:

android:divider

The color of the divider lines when a group is opened aka. the child is visible can be set via:

android:childDivider

Solution 2

For Group:

<item name="android:groupIndicator">@android:drawable/expander_group</item>

For Children:

<item name="android:childDivider">@android:drawable/divider_horizontal_dark_opaque</item>

All the ExpandableListView traits:

<style name="Widget.ExpandableListView" parent="Widget.ListView">
    <item name="android:groupIndicator">@android:drawable/expander_group</item>
    <item name="android:indicatorLeft">?android:attr/expandableListPreferredItemIndicatorLeft</item>
    <item name="android:indicatorRight">?android:attr/expandableListPreferredItemIndicatorRight</item>
    <item name="android:childDivider">@android:drawable/divider_horizontal_dark_opaque</item>
</style>

<style name="Widget.ExpandableListView.White">
    <item name="android:childDivider">@android:drawable/divider_horizontal_bright_opaque</item>
</style>
Share:
10,530
RajV
Author by

RajV

Updated on June 04, 2022

Comments

  • RajV
    RajV about 2 years

    enter image description here

    I can set the devider color for the children using childDivider attribute (black in this example). But, I don't see any way to set the color of the divider between the collapsed groups. System seems to be showing a 1px white line.