Create a cursor adapter to display more items than in cursor itself [duplicate]
Possible Duplicate:
Android: custom separator (or even item) in ListView depening on content of item
I've got a cursor from database query. Imagine it contains N items. Each of these items are of the same view type开发者_运维问答, but they differ in some cursor's field value (let's name it a data type).
I want to draw a list view with the following content (drawing a some "separator" before each of data type group).
--DataType1---------
Item1
Item2
--DataType2---------
Item3
--DataType3---------
Item4
Item5
The problem is what i have only 5 rows in cursor but need to draw 8 items in ListView
(3 of one view type - a separator, and 5 of another view type).
Is there an ability to do this?
P.S. I know how to implement custom adapter, i know what getItemViewType
and getViewTypeCount
is for.
I believe this is a duplicate, answered here.
I also do something similar in my public domain Dhammapada app, in HeadingAdapter.java.
精彩评论