开发者

Android listview groups

开发者 https://www.devze.com 2023-01-20 20:41 出处:网络
I have Activity for displaying search results. It extend开发者_StackOverflow社区s ListActivity. I need to show search results in listview grouping several items. So, how do I add grouping to my listvi

I have Activity for displaying search results. It extend开发者_StackOverflow社区s ListActivity. I need to show search results in listview grouping several items. So, how do I add grouping to my listview?


You give your ListView a ListAdapter that knows how to do the grouping.

This could be a matter of overriding getViewTypeCount() and getItemViewType() in the adapter to describe which positions get which sorts of rows, plus modifying getView() (or newView() and bindView() for CursorAdapter) as needed.

Depending on what you are starting with, you might be able to use something like my MergeAdapter instead.

0

精彩评论

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