Android - show footer divider but no list row divider
I have a list view which has a footer. It dis开发者_JS百科plays numbers and at the bottom is the total.
I want to be able to show the rows without a divider between them. OTOH I DO want a divider before the summary row. Is there any easy way to do this?
You can set android:dividerHeight
to 0
in your list.
Then use custom layout for footer in which you add divider by yourself. For example, that can be a TextView
with no text, android:layout_height
set to 2
and android:background
set to some color.
When you have custom layout for the footer, just add divider on top of it. It can be for example View of hight 2dp and different background color.
I had to do this programatically, since setting android:dividerHeight="0dip" in the XML didn't work for me:
getListView().setDividerHeight(0);
精彩评论