9

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

Gaurav Arora
  • 8,282
  • 21
  • 88
  • 143
  • 1
    Check this Example http://androidtrainningcenter.blogspot.in/2012/03/android-listview-with-section-header.html – Pragnani May 17 '13 at 05:14
  • 1
    http://android.amberfog.com/?p=296 – Lalit Poptani May 17 '13 at 05:18
  • **Check this Example This Can help you** http://custom-listview-with-separate-headers.blogspot.in/ –  Oct 07 '13 at 10:45
  • Wow, this SO question's answers have to be the worst answers I have ever come across on SO. Every single answer is a link to either a tutorial or a 3rd party library. None of the answers have bothered to explain how to do it. Also no guarantee that the links won't be dead in the future. – sudoExclaimationExclaimation Jan 25 '19 at 22:46

6 Answers6

2

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.

Community
  • 1
  • 1
Jerry Jeremiah
  • 9,045
  • 2
  • 23
  • 32
2

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.

Snicolas
  • 37,840
  • 15
  • 114
  • 173
2

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

Community
  • 1
  • 1
Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295
2

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

Asthme
  • 5,163
  • 6
  • 47
  • 65
1

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/

Anup Cowkur
  • 20,443
  • 6
  • 51
  • 84
  • 2
    Dont always opt for libraries while they help and aid development ...3rd party libraries may open up security holes. – auracool Nov 27 '14 at 14:30
0

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

Community
  • 1
  • 1
Harsh Parikh
  • 3,845
  • 3
  • 14
  • 14