如何划分和加载多个零件一个ListView? [英] How to divide and load a ListView in multiple parts?
问题描述
我想知道我怎么能分割的部分我的ListView
键,当用户启动我的应用程序中显示的只是其中的一部分,显示别人当用户preSS一个按钮所谓的装入多个项目。
I am wondering how could i divide my ListView
in parts and display only one part of it when user starts my app and display others when user press a Button called "Load More Items".
我有超过500项的大名单,并想将其划分成几部分,因此它可能加载速度不够快。
I have a big list of more than 500 items and thinking to divide it into parts so it could load fast.
我要的功能类似于任何电子邮件应用程序,它提供了一个选项,在底部装载更多的电子邮件。
I want functionality similar to an any email app which gives an option at the bottom to load more emails.
如果任何人有任何样本$ C $下我的问题,那么请分享其他一些指导也将是AP preciated。
If anyone has any sample code for my problem then please share else a little guidance would also be appreciated.
推荐答案
以及实现一个按钮是很容易的:
well implementing a button is easy enough:
在您的onCreate,加载适配器1日50个项目,然后实现与onClickListener,增加了在未来50等按钮
in your onCreate, load your adapter with the 1st 50 items, then implement a button with an onClickListener that adds the next 50 etc.
不过 我觉得你真正想要做的是延迟加载你的列表视图,以便他们滚动,它会加载更多的项目 - 所以你不必弄乱UI与一个额外的按钮
HOWEVER I think what you really want to do is lazy load your listview so as they scroll, it will load more items - that why you don't need to clutter the UI with an extra button.
这个你listactivity应该实施OnScrollListener
for this your listactivity should implement OnScrollListener
here is an example of that: Android Endless List
这篇关于如何划分和加载多个零件一个ListView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!