Hiding ListView Header / Hiding Single Divider in a List

M.E. picture M.E. · Jan 7, 2011 · Viewed 15.3k times · Source

I found this Hide footer view in ListView?. As Yoni poited out correctly, you can hide a header in a ListView by wrapping it into a FrameLayout and setVisibility() of the inner View to View.GONE. This works almost perfect for me, BUT: As the FrameLayout still exists, the ListView adds two dividers to the displayed list. It seems like a single divider with a height of two dividers. Is there a way to hide a single divider of a ListView? Maybe it's possible to change the divider's color to the background, that would be fine for me, too. Any complete other ideas? Perfect!

Please help me. I'm not keen on spending two more hours of trial and error.

Thanks a lot!

Answer

HostedMetrics.com picture HostedMetrics.com · Aug 17, 2011

Together with hiding or showing your header or footer, use these functions:

setFooterDividersEnabled()
setHeaderDividersEnabled()