Android Separator ExpandableListView Invisible

I have the following ExpandableListView:

<ExpandableListView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:id="@+id/listView"
            android:groupIndicator="@android:color/transparent"
            android:background="@color/app_background"
            android:scrollingCache="false"
            android:choiceMode="none"
            android:divider="@color/gray_dark"
            android:dividerHeight="2dp"
            android:childDivider="@color/gray_dark"
            android:cacheColorHint="@color/app_background"/>

The problem that comes up with me is that the extensible list view doesn't draw separators, or at least not visible. I am adding a custom view as a Group view, as well as custom list items in my extensible adapter. Could this be a problem?

Does anyone know what I can do to enable separators for a child list?

Thanks in advance.

+5
source share
2 answers

It seems that I had a problem with my extensible adapter. I was overridden in the following way:

@Override
public boolean areAllItemsEnabled() {
    return true;
}

, true, false, ... , - , , true, false.

, , BaseExpandableListAdapter

+13

xml, . , , . , , .

import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.GradientDrawable.Orientation;

// code to set up expandablelistview

int[] colors = {0, 0xFFFF0000, 0}; // red for the example 
getListView().setDivider(new GradientDrawable(Orientation.RIGHT_LEFT, colors)); 
getListView().setChildDivider(new GradientDrawable(Orientation.RIGHT_LEFT, colors)); 
getListView().setDividerHeight(4); 
0

All Articles