Android: custom separator (or even item) in ListView depening on content of item?

Here is one implementation that does exactly what you describe That one is GPLv3, because it is derived from this implementation which was GPLv3 You can also use my MergeAdapter for this, which has the advantage of being Apache License 2.0. Just hand it an alternating set of header TextView s and Adapter s containing each section's worth of content Or, you can peek at all of these and roll their behaviors into your existing Adapter class. The trick is to return your TextView headers at the right spot, and properly implement methods like getViewTypeCount() getItemViewType() areAllItemsEnabled() and isEnabled().

Here is one implementation that does exactly what you describe. That one is GPLv3, because it is derived from this implementation, which was GPLv3. You can also use my MergeAdapter for this, which has the advantage of being Apache License 2.0.

Just hand it an alternating set of header TextViews and Adapters containing each section's worth of content. Or, you can peek at all of these and roll their behaviors into your existing Adapter class. The trick is to return your TextView headers at the right spot, and properly implement methods like getViewTypeCount(), getItemViewType(), areAllItemsEnabled(), and isEnabled().

– Tawani Oct 22 '09 at 14:30 There is a screen shot of the first one in my Advanced Android book. There is a screen shot of the second one on Jeff Sharkey's site, as linked to above. I do not have a screen shot of the third one anyway, in large part because it would not be a screen shot of MergeAdapter, but a screen shot of whatever you poured into MergeAdapter.

– CommonsWare Oct 22 '09 at 14:37 Your implementation of SectionedAdapter works beautifully. Thanks! A quick question: Is there a way to remove the bottom divider from the last list item of each section?

– ploppy Nov 20 '10 at 6:25 @Jeffrey: Ummm...probably not easily. Those dividers are put there by Android, for all selectable items. – CommonsWare Nov 20 '10 at 13:15 Understandable, thanks CommonsWare – ploppy Nov 21 '10 at 9:56.

Here is even nicer implementation, inspired from iOS section list view : code.google.com/p/android-section-list/. The nie thing about it is that the section header remains visible even if you scroll the section down.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions