Naftuli Kay
Naftuli Kay

Reputation: 91640

"Separators" in ListView

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?

Upvotes: 8

Views: 15428

Answers (4)

Jarek Potiuk
Jarek Potiuk

Reputation: 20077

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).

Upvotes: 4

De-Coder
De-Coder

Reputation: 9

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>

Upvotes: 0

Matthew
Matthew

Reputation: 44919

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)

Upvotes: 1

alexanderblom
alexanderblom

Reputation: 8622

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

Upvotes: 7

Related Questions