实例化View Pager Android中的所有项目 [英] instantiate all items in view pager android

查看:73
本文介绍了实例化View Pager Android中的所有项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有查看寻呼机和三个要显示页面的活动.每当活动加载时,仅实例化前两个页面,即,仅针对位置0和1调用pageradapter类中的实例化项目.是否有一种实例化所有三个页面的方法?

I have an activity with a view pager and three pages to display. When ever the activity loads, only the first two pages are instantiated i.e instantiateitem in the pageradapter class is called only for position 0 and 1. Is there a way to instantiate all the three pages?

推荐答案

尝试

Try setOffScreenPageLimit(2). By default only one page to the left and to the right are instantiated. By setting to 2 it should instantiate your 3 pages.

这篇关于实例化View Pager Android中的所有项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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