自动增长的ListView在Android中 [英] Autogrow ListView in Android

查看:182
本文介绍了自动增长的ListView在Android中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做搜索周围相关的一个,我要问的各种问题。我只想问它清晰简单的方式,并希望得到一个明确而简单的答案:)

I did search around various questions related to the one I'm about to ask. I just want to ask it in clear and simple manner and hopefully get a clear and simple answer :)

我有一个列表的,我想present在的ListView 用户数百余项窗口小部件。起初我想开始说的50个项目,并为底部附近用户滚动我要添加其他50等等。我认为Gmail收件箱会是什么,我需要一个很好的例子。我没兴趣光标实施 - 数据集是很简单的,我说现在它只是一个列表

I have a List of several hundred items that I want to present to the user in ListView widget. Initially I want to start with say 50 items and as user scrolls near the bottom I want to add another 50 and so forth. I think GMail Inbox would be a good example of what I need. I'm not interested in Cursor implementation - the dataset is quite simple as I said for now it's just a List.

另外 - 说的ListView 增长得太大,这将是很好,开始从顶部,它表现为一个滑动标尺其最大显示大约200行砍它( 30查看)

Also - say ListView grows too big, it would be nice to start chopping it from the top so it behaves as a sliding ruler at it max showing about 200 rows (with 30 viewable)

推荐答案

您可以试试我的 EndlessAdapter 。其隐藏了 ListAdapter 您提供并让当用户到达底部加载额外的数据。你可以尝试也从顶部取出物品(例如,删除() ArrayAdapter ),尽​​管我是一个有点担心 - 的Andr​​oid可能没有做出正确的决策如果说,你的名单不会改变大小,但行改变阵容

You can try my EndlessAdapter. It wraps a ListAdapter that you supply and lets you load additional data when the user reaches the bottom. You could try also removing items from the top (e.g., remove() on ArrayAdapter), though I'm a bit nervous about that -- Android might not make the right decisions if, say, your list does not change size but the lineup of rows changes.

这篇关于自动增长的ListView在Android中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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