无法设置 ExpandableListView 子 DividerHeight
我正在使用 ExpandableListViews,它需要在组之间有一个分隔线,但在组和它的子级之间不需要。
我找不到完成此操作的方法,我已经尝试过的是:
将
android:dividerHeight
设置为 0。结果:组之间仍然有 1dip 的空间它是子元素。如果我尝试用颜色或透明度而不是可绘制对象填充该空间,它不会显示,因此间隙仍然可见。如果
android:dividerHeight
大于 0,它会显示颜色。如果我将
android:dividerHeight
设置为 -1,组与其子项之间的间隙就会消失。组之间的分隔线显然也会消失。几乎在网络的每个角落搜索了一个简单的解决方案,但似乎还没有人遇到过这个问题。
我一直在想的是: 删除所有分隔符,将它们添加到行布局中,但是,这将是大量额外且不必要的工作。我必须为最后一组删除它们。
有人知道我的意思吗?你有更好的解决方案吗?预先非常感谢您的分享!
干杯!
做
I'm working with ExpandableListViews, which need to have a divider between groups, but not between the the group and it's child.
I can't find a way to get this done, what I've already tried is:
Set the
android:dividerHeight
to 0. Result: there is still a space of 1dip between the group and it's child.If I then try to fill that space with a color or transparency instead of a drawable, it doesn't show, so the gap is still visible. If
android:dividerHeight
is larger than 0, it shows the color.If I set the
android:dividerHeight
to -1 the gap between the group and it's child dissappears. The divider between the groups obviously also dissappears.Searching in almost every corner of the web for an easy solution, but it seems that no one has encountered this problem yet.
What I've been thinking of is the following:
Remove all dividers add them to the row layouts, however, this would be a lot of extra and imo unneccesary work. And I would have to remove them for each last group.
Does anybody have a clue what I mean and do you have a better solution? Thanks a lot in advance for sharing!
Cheers!
Do
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许更简单的方法是将组和子项之间的分隔线颜色设置为列表背景颜色?
Maybe simpler would be to set the divider color between group and child to the list background color?
你快到了。我也在做同样的事情。
怎么样,将dividerheight设置为0px然后在组布局中创建您自己的分隔线。
You'r nearly there. I'm doing the same.
How about this, Set dividerheight to 0px Then create your own divider in the group layout.