"Separators" in ListView
Asked Answered
R

4

8

I have an ArrayAdapter which is hooked up to my ListView. I really like the "separators" feature in the Evernote Android application, where they separate items using a datestamp:

screenshot 1 screenshot 2 screenshot 3 enter image description here

I assume what they're doing is having a view immediately above the list which is set to the value of the current separator, as you can see in the screenshots. (As you scroll past a separator, the text at the top is set to the value of the current separator, ie "January 2011") How would I actually insert the separators into my ListView?

Rhythmical answered 28/2, 2011 at 22:34 Comment(0)
N
7

A separator is simply a disabled list item, just have your Adapter return the separator where it should be. Seems like SectionIndexer could help.

Nymphalid answered 28/2, 2011 at 22:39 Comment(0)
N
4

And here is one which does exactly this : https://github.com/Polidea/android-section-list with transparent section header sticky at the top of the list (similar to iOS section list which comes out of the box there).

Narcosis answered 13/6, 2011 at 0:19 Comment(0)
H
1

We're on our own on this one.

I made my own ListView with headers for one of my apps: Dhammapada (look for HeadingAdapter and associated classes)

Hunter answered 28/2, 2011 at 22:41 Comment(0)
F
0

set two layouts on a single screen one above other... then add scroll to layout which is below... then add list view in d second half layout ... fix it up and deploy ur sh$T and its done !! Note : dont add scroll in main layout .. just on layout which is underneath :p

eg:-

<LL1 
bla bla
>

<LL2 bla bla>
</LL2>

<LL3 scroll bla bla>
<ListView bla bla>
</ListView> 

</LL3>

</LL1>
Frankfurter answered 28/10, 2012 at 9:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.