Android: Hide child dividers in ExpandableListView
If you want to completely remove dividers from ExpandableListView
, setDividerHeight
is ok for both parent and child items. Child divider will be draw using the same height as the normal divider or set by setDividerHeight()
.
And I am using one work around for us to hide one and unhide the other one, just set the divider and items in the same color like below:
ExpandableListView expView = getExpandableListView();
expView.setGroupIndicator(null);
expView.setChildIndicator(null);
expView.setChildDivider(getResources().getDrawable(R.color.greywhite));
expView.setDivider(getResources().getDrawable(R.color.white));
expView.setDividerHeight(2);
setDividerHeight
must below setChildDivider
and setDivider
, or the height will be 0.
Waiting for more answers...
to hide the child divider set it color to transparent #00000000
define transparent in your color.xml file
<color name="transparent">#00000000</color>
and then set the child divider
listView.setChildDivider(getResources().getDrawable(R.color.transparent))
or in the layout xml file
<ExpandableListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:childDivider="#00000000"/>