带有异步任务的 Android Viewpager(页面加载时旋转)
我想要一个在内容从后台传入时显示加载的 Viewpager。基本上我希望加载第一个 View,但 View+1 和 View-1 仍将加载。如果用户向任一侧滑动,我希望在加载时向他们显示一个旋转对话框,
我是否只需将 AsyncTasks 添加到 ViewPager 中,并确定它们何时运行?我不希望加载太多 AsyncTasks,因为 viewpager 的侧面会有很多视图。
我认为 Trulia 应用程序可以做到这一点,它与我正在寻找的类似。当图像在该视图页面中加载时,公寓图像查看会显示加载屏幕。
另请注意,我可以将 viewpagers 视为活动的 onCreate 函数吗?这真的会澄清事情的
洞察力赞赏
I want a Viewpager that shows loading while content is coming in from the background. Basically I expect the first View to be loaded, but View+1 and View-1 will still be loading. If the user swipes to either side I want them to be presented with a spinning dialog while it loads
Would I just add AsyncTasks into the ViewPager with some conditions determining when they will run? I dont want too many AsyncTasks to be loading as the viewpager will have many views off to the sides.
I think the Trulia app does this, it is similar to what I am looking for. Apartment image viewing shows a loading screen while the images are loading in that viewpage.
Also for the record, can I just treat viewpagers like onCreate functions of an activity? That would really clear things up
Insight appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想对每个页面执行更多类似 Activity 的生命周期管理,请查看提供的 FragmentPagerAdapter。
Have a look at the supplied FragmentPagerAdapter if you want to perform more Activity-like lifecycle management of each page.