Gaurav Arora
Gaurav Arora

Reputation: 8362

Custom List View With Custom Headers Android

I have to make a custom list view with custom header, ( different text in each headers) and different number of items below each header. I have been going through various section indexing examples but I think they are not relevant much to my answer.

Anybody please suggest me a good means to move around such type of list view in android.

enter image description here

Upvotes: 9

Views: 21658

Answers (6)

Harsh Parikh
Harsh Parikh

Reputation: 3845

Why can't you use expandable list view? this link might help you: Android Exandable listview tutorial

Upvotes: 0

Asthme
Asthme

Reputation: 5353

Try this tutorial..its very nice and simple http://www.androidhive.info/2013/07/android-expandable-list-view-tutorial/

Upvotes: 2

Snicolas
Snicolas

Reputation: 38168

For a more complex design with sections in list, you should try this very standard library : https://github.com/emilsjolander/StickyListHeaders.

Other alternatives mentionned are great.


I should mention that the only drawback of this library is a poor mavenization and its absence on central.

Upvotes: 2

Paresh Mayani
Paresh Mayani

Reputation: 128428

There has been lot of thread exists on the Stackoverflow, check:

  1. Android Listview with sections
  2. Android ListView section header
  3. How to draw a section header in Android listview just like the Contacts app did ?

But I am not sure these threads has helpful info, but if you want to read, understand and implement ListView with sections then here is one of the great and detailed article given by Cyril: ListView Tips & Tricks #2: Sectioning Your ListView

Upvotes: 2

Jerry Jeremiah
Jerry Jeremiah

Reputation: 9618

This might be a duplicate of Android Listview with sections

There are lots of different ones out there. One example is: http://w2davids.wordpress.com/android-sectioned-headers-in-listviews which uses: http://jsharkey.org/blog/2008/08/18/separating-lists-with-headers-in-android-09

That one allows you to pass in different array adapters for each section so that you can have different layouts for each section's items.

If you were more clear about what the ones you have seen fail to do that you need it would be easier to offer you something you haven't seen.

Upvotes: 2

Anup Cowkur
Anup Cowkur

Reputation: 20553

There's a very good library for this. I've used in a project or 2 myself. Check it out:

https://code.google.com/p/android-amazing-listview/

Upvotes: 1

Related Questions