自定义ListView中的分割线

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:dividerandroid: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:footerDividersEnabled表示是否显示分割线.
这个解释 是错误的,
原文:When set to false, the ListView will not draw the divider before each footer view.
意思 是说:仅仅是footer View不显示
listview.addFooterView(View v) 这些的才是真正的footer 。
当然addFooterView方法还得是
addFooterView(View v, Object data, boolean isSelectable)
isSelectable为 true;

猜你喜欢

转载自guocc.iteye.com/blog/1709907