3

Are there any built-in ways for creating Android ListView section headers? If not what is the easiest way for doing so, using XML markup as far as possible?

siva636
  • 16,109
  • 23
  • 97
  • 135
  • Do you mean you want to add a header view? : http://developer.android.com/reference/android/widget/ListView.html#addHeaderView%28android.view.View%29 – znat Dec 06 '12 at 14:23
  • I think this is for a single header. I want multiple headers in a single ListView. – siva636 Dec 06 '12 at 15:39

2 Answers2

6

No. You can make your own implementation or use a third-party library. I suggest you to use this one in case you want them to stick at the top of the list:

https://github.com/emilsjolander/StickyListHeaders

Flávio Faria
  • 6,575
  • 3
  • 39
  • 59
1

You can add several headers using addHeaderView (View v). Your views are then handled by a HeaderViewListAdapter

znat
  • 13,144
  • 17
  • 71
  • 106
  • 4
    It seems addHeaderView() is for adding header(s) at the top of the list, but not for section headers. – siva636 Dec 07 '12 at 06:57