ViewPager.setOffscreenPageLimit(0) doesn't work as expected
2015-12-29 14:49
633 查看
(转载)http://stackoverflow.com/questions/10073214/viewpager-setoffscreenpagelimit0-doesnt-work-as-expected?lq=1
Does ViewPager require a minimum of 1 offscreen pages
Yes. If I am reading the source code correctly, you should be getting a warning about this in LogCat, something like:
解决方案:
The best way that I found was setUserVisibleHint
add this to your fragment
Does ViewPager require a minimum of 1 offscreen pages
Yes. If I am reading the source code correctly, you should be getting a warning about this in LogCat, something like:
Requested offscreen page limit 0 too small; defaulting to 1
解决方案:
The best way that I found was setUserVisibleHint
add this to your fragment
@Override public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser); if (isVisibleToUser) { // load data here }else{ // fragment is no longer visible } }
相关文章推荐
- UIViewController的生命周期及iOS程序执行顺序
- UGUI
- Android中多界面的退出
- Burp Suite使用介绍——Proxy功能(二)
- iOS---textfield设置为只有下划线,并且左边有图片
- 【转】带参数的主函数
- Android 网络请求详解
- sphinx增量索引和主索引来实现索引的实时更新
- linux TXT文件操作 '^@ ' 'NUL' 符号乱码问题
- IntelliJ IDEA常见问题
- leetcode:257 Binary Tree Paths-每日编程第四十五题
- shell中各种括号的作用()、(())、[]、[[]]、{}
- ==与equals区别
- Android拍照裁剪图片
- 一步一步学习 Linux 驱动之 platform 机制(tiny210 按键驱动)
- java -------SimpleDateFormat之后为何多了一年
- Unity3D核心类型一览
- JMeterPluginCMD命令行工具生成png图片和csv统计文件
- Spark访问HBase的Eclipse代码实现
- 深入理解JavaScript系列文章集锦