Android:在ExpandableListView中隐藏子分隔符
我需要从ExpandableListView中完全移除分隔符。 至于父项,它是一个setDividerHeight方法,我可以传递一个零值。 但是没有类似的子分频方法。 有什么办法可以隐藏它吗?
如果您想要从ExpandableListView完全删除分隔setDividerHeight , setDividerHeight对于父项和子项都是可以的。 子分隔符将使用与普通分隔符相同的高度进行绘制,或由setDividerHeight()设置。 
而且我正在使用一个工作来隐藏一个隐藏另一个工具,只需将分隔线和项目设置为相同的颜色,如下所示:
  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必须低于setChildDivider和setDivider ,否则高度将为0。 
等待更多的答案…
隐藏子分隔符将其颜色设置为透明#00000000
在你的color.xml文件中定义透明
 <color name="transparent">#00000000</color> 
然后设置子分频器
 listView.setChildDivider(getResources().getDrawable(R.color.transparent)) 
或者在布局xml文件中
 <ExpandableListView android:layout_width="fill_parent" android:layout_height="fill_parent" android:childDivider="#00000000"/> 
将expandableListView的分隔高度设置为0
 //setDividerHeight(0) 
然后在headerView xml的底部添加一个视图
 <View android:layout_width="match_parent" android:layout_height="1dp" android:layout_gravity="bottom" android:background="@android:color/darker_gray" /> 
如果只想移除子分隔符,则可以创build一个与子背景颜色相同颜色的可绘制对象。 然后将其设置为您的孩子分隔符。
 ShapeDrawable sd1 = new ShapeDrawable(new RectShape()); sd1.getPaint().setColor(YOUR CHILD ITEM BACKGROUND COLOR); mExpListView.setChildDivider(sd1); 
你可以使用属性
 <ExpandableListView android:id="@+id/interestlvExp" android:layout_height="wrap_content" android:layout_width="match_parent" android:divider="@null"> </ExpandableListView> 
但是这也会删除组列表分隔符。