在ViewPager中仅加载一个片段 [英] Load only one Fragment in ViewPager
本文介绍了在ViewPager中仅加载一个片段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经将ViewPager
与Fragment
一起使用了.
I have used ViewPager
with Fragment
.
But it loads two pages at time.
Is there any way to load only one page in viewpager ?
推荐答案
这可能是您正在寻找的东西:
This might be the thing you are looking for:
mPager.setOffscreenPageLimit(n); // where n is the number of offscreen pages you want to load.
**如您所说,其最小值可以为"1". **检查此链接,并阅读评论.
**The minimum value of it can be "1" as you said. ** check this link and also read the comments.
这篇关于在ViewPager中仅加载一个片段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文