隐藏的ListView页眉/隐藏单分频器的列表分频器、页眉、列表、ListView

2023-09-04 12:48:32 作者:别害怕我不是好人

我发现这个隐藏页脚视图中的ListView?。由于号Yoni poited正确,您可以通过包装成一个的FrameLayout 和 setVisibility()的内部查看 View.GONE 。这个作品几乎适合我,但是: 由于的FrameLayout 仍然存在,的ListView 增加了两个分频器所显示的列表中。好像有两个分隔的高度单一的分频器。有没有一种方法来隐藏的ListView 单分?也许这是可以改变分频器的颜色与背景颜色,这将是对我很好了。任何完成其他的想法?完善!

I found this Hide footer view in ListView?. As Yoni poited out correctly, you can hide a header in a ListView by wrapping it into a FrameLayout and setVisibility() of the inner View to View.GONE. This works almost perfect for me, BUT: As the FrameLayout still exists, the ListView adds two dividers to the displayed list. It seems like a single divider with a height of two dividers. Is there a way to hide a single divider of a ListView? Maybe it's possible to change the divider's color to the background, that would be fine for me, too. Any complete other ideas? Perfect!

请帮助我。我并不热衷于花费两个小时的试验和错误。

Please help me. I'm not keen on spending two more hours of trial and error.

非常感谢!

推荐答案

您可以改变分频器的颜色是这样的:

you can change the dividers color like this:

     <ListView 
    android:id="@+id/android:list"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:divider="@android:color/transparent"
    android:dividerHeight="2px"/>