对于ViewPager项目延迟加载数据 [英] Lazy load data for ViewPager Items

查看:84
本文介绍了对于ViewPager项目延迟加载数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含片段 A ViewPager ,现在 ViewPager 包含3个不同的项目,即每个项目(页)包含一个的ListView 和每个列表HASE它自己的适配器,我不能使用 FragmentPagerAdapter

I have a Fragment that contains a ViewPager , now the ViewPager contains 3 different items , i.e each item(Page) contains a ListView and each list hase it Own Adapter , I cant use FragmentPagerAdapter

正弦 ViewPager 住在片段

我应该加载所有的三个列表视图数据在片段,并把它传递给 PagerAdapter

Should i Load all the Three ListViews Data in the Fragment and pass it to the PagerAdapter ?

推荐答案

其实这取决于你有多大的数据时,将您加载?

Actually it depends how big is your data which are you loading?

如果是大,尝试下载IE浏览器。 10个项目的每一页,并通过这些数据适配器和缓存它。以后有什么,实施延迟加载器(如在谷歌Play应用程式),它会下载你的下一个项目为您正确的页面,而不是所有的。

If it is big, try to download ie. 10 items for each page and pass that data to adapters and cache it. After what, implement lazy loader (like in google play app), which downloads your next items for your correct page, not for all.

所以,你的所有的三页就必须要显示的数据在第一负载,如果用户想要更多,他可以导航到列表的底部,preSS加载更多,并获得更多的项目:)

So all your three pages would have data to display on a first load, if user wants more, he can navigate to the bottom of your list, press "load more" and get more items :)

从我的经验这个解决方案正常工作。当然,服务器端应该为这种装载机通过。

From my experience this solution works fine. Of course server side should be adopted for this kind of loader.

也有更多的考虑,即也许你的数据是非常活。所以,你必须考虑一下。

Also there are more considerations, ie. maybe your data is "very live". So you have to think about it.

这篇关于对于ViewPager项目延迟加载数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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