Show divider after the last item in the list

做~自己de王妃 提交于 2019-12-10 09:32:45

问题


I added a divider drawable to my listview but it appears for all the items except after the last item.

I only have 5 items on the list, so its all white space after the last item, i want to have a divider even after the last item

i tried this:

android:footerDividersEnabled="true"

in my listview. But it didnt work

Thank You


回答1:


Try following in XML

<View
    android:background="#00ff00"
    android:layout_width="fill_parent"
    android:layout_height="3dp"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/YOUR_LIST_ID" />



回答2:


Horizontal line

<View
android:id="@+id/view"
android:background="#FF4500"
android:layout_width="fill_parent"
android:layout_height="2dp"     
android:layout_below="@+id/listview_id" />

vertical line

 <View
android:id="@+id/view"
android:background="#FF4500"
android:layout_width="2dp"
android:layout_height="fill_parent"     />


来源:https://stackoverflow.com/questions/11796662/show-divider-after-the-last-item-in-the-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!