开发者

Create a cursor adapter to display more items than in cursor itself [duplicate]

开发者 https://www.devze.com 2023-02-24 08:18 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Android: custom separator (or even item) in ListView depening on content of item
This question already has answers here: Closed 11 years ago.

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.

0

精彩评论

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

关注公众号