instantiate all items in view pager android

房东的猫 提交于 2019-12-21 07:18:08

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/10046484/instantiate-all-items-in-view-pager-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!