android給listview設置分割線Divider樣式

設置分割線的例子如下:

<ListView android:id="@+id/HomeListView" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:divider="#123"
android:layout_margin="10dip"></ListView>

但運行後,發現樣式沒起作用。

解決辦法:
給listview設置android:dividerHeight爲非0即可。

如:
<ListView android:id="@+id/HomeListView" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:divider="#000"
android:dividerHeight="1px"
android:layout_margin="10dip"></ListView>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章