开发者

"Separators" in ListView

开发者 https://www.devze.com 2023-02-14 12:43 出处:网络
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:

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:

"Separators" in ListView

"Separators" in ListView

"Separators" in ListView

"Separators" in ListView

I assume what they're doing is having a view imme开发者_运维百科diately 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?


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


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


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)


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消