Android的列表视图组 [英] Android listview groups

查看:107
本文介绍了Android的列表视图组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有活动,显示搜索结果。它扩展ListActivity。我需要显示在列表视图搜索结果划分几个项目。所以,我怎么添加分组到我的列表视图?

I have Activity for displaying search results. It extends ListActivity. I need to show search results in listview grouping several items. So, how do I add grouping to my listview?

推荐答案

你给你的的ListView A ListAdapter 的知道如何做分组。

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

这可能是覆盖 getViewTypeCount() getItemViewType()在适配器来形容其立场的问题得到这种种行,再加上修改 getView()(或 NewView的() bindView ()的CursorAdapter )的需要。

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.

根据您从开始什么,你也许能够使用的东西,像我 MergeAdapter 代替。

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

这篇关于Android的列表视图组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆