Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"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 1screenshot 2screenshot 3enter 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?

like image 552
Naftuli Kay Avatar asked Feb 28 '11 22:02

Naftuli Kay


1 Answers

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

like image 67
alexanderblom Avatar answered Nov 03 '22 09:11

alexanderblom