Hide separator without hiding childDivider on ExpandableListView

I cannot find a way to hide the delimiters in the ExpandableListView without hiding the child delimiters.

Here is my code.

<ExpandableListView android:id="@+id/activities_list" android:background="@android:color/transparent" android:fadingEdge="none" android:groupIndicator="@android:color/transparent" android:divider="@android:color/transparent" android:childDivider="@drawable/list_divider" android:layout_width="fill_parent" android:layout_height="wrap_content" /> 

With this code, I don't get group delimiters, but not a single child delimiter. If I set android:divider to "@drawable/list_divider" , I get both group and child delimiters.

Thanks in advance!

+4
source share
5 answers

The only solution I found was to set the child divider directly in the child XML, this way:

 <TextView android:id="@+id/name" android:layout_centerVertical="true" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <ImageView android:id="@+id/divider" android:layout_alignParentBottom="true" android:layout_width="fill_parent" android:layout_height="1dp" android:background="@drawable/list_divider" /> 

which is very ugly but works.

But still, there must be a way to do it right.

+1
source
 expListView.setDivider(null); expListView.setDividerHeight(2); 

it will work

+1
source

Adding the dividerHeight parameter to your ExpandableListView in your XML layout should do the trick

0
source

How to simply add a line:

Android: dividerHeight = "0dp"

Actually, I am facing a similar problem. PD asks that the separator and childDivider both exist and are different, which really bothers me. I am also looking for answers.

0
source

In my opinion: -Remove the delimiter in XML:

 android:divider="@null" android:dividerHeight="0dp" 

-Draw divider in getGroupView (.., .., .., ..):

  View divider = new View(_context); View dividerIDU = new View(_context); RelativeLayout.LayoutParams rldivider = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, 1); RelativeLayout.LayoutParams rldividerShort = new RelativeLayout.LayoutParams( 150, 3); rldividerShort.setMargins(5, -1, 0, 0); dividerIDU.setBackgroundColor(Color.RED); divider.setLayoutParams(rldivider); dividerIDU.setLayoutParams(rldividerShort); divider.setBackgroundColor(Color.rgb(200, 200, 200)); ((RelativeLayout) convertView).addView(divider); ((RelativeLayout) convertView).addView(dividerIDU); 

-After you can set the separator after the group position.

0
source

Source: https://habr.com/ru/post/1391257/