Search code examples
androidexpandablelistview

Android Accordion-Style ListView


I'm looking for a control similar to ExpandableList that allows me to scroll a list view, but the group header stays on the top of the screen until it is pushed off by the next group header. The rows would collapse and expand similar to an accordion.

Initial view:

GROUP A
Row 1
Row 2
GROUP B
Row 1
Row 2

Scrolling down would cause this sequence:

GROUP A
Row 2
GROUP B
Row 1
Row 2
GROUP C

GROUP A
GROUP B
Row 1
Row 2
GROUP C
Row 1

GROUP B
Row 1
Row 2
GROUP C
Row 1
Row 2

Scrolling the opposite direction would have the reverse effect.

Is there something existing either in the Android SDK or something someone has previously made, or can someone point me in the right direction to creating this?


Solution

  • You mean a Sticky Header ListView. Search Google, you'll find the link to the project page.

    Here's one project: https://github.com/emilsjolander/StickyListHeaders
    Here's another one: https://github.com/applidium/HeaderListView
    Another one; http://www.appance.com/headerlistview/

    And this is only the first result page... ;)