ListView中每个Item项之间都有分割线,设置android:footerDividersEnabled表示是否显示分割线,此属性默认为true。
1.不显示分割线只要在ListView控件中添加android:footerDividersEnabled="false"即可。
<ListView android:id="@+id/local_groups_list" android:layout_width="match_parent" android:layout_height="wrap_content" android:footerDividersEnabled="false" />
2.改变ListView的分割线颜色和宽度,需要在布局中定义android:divider和android:dividerHeight属性。
<ListView android:id="@+id/local_groups_list" android:layout_width="match_parent" android:layout_height="wrap_content" android:divider="@color/divider_color" android:dividerHeight="1px" />
本文介绍如何在Android开发中禁用ListView项之间的默认分割线及如何自定义分割线的颜色与宽度。通过简单地设置属性android:footerDividersEnabled=false可以隐藏分割线;若要更改分割线样式,则需定义android:divider和android:dividerHeight属性。
192

被折叠的 条评论
为什么被折叠?



