<bdo id='yeQgk'></bdo><ul id='yeQgk'></ul>

      <i id='yeQgk'><tr id='yeQgk'><dt id='yeQgk'><q id='yeQgk'><span id='yeQgk'><b id='yeQgk'><form id='yeQgk'><ins id='yeQgk'></ins><ul id='yeQgk'></ul><sub id='yeQgk'></sub></form><legend id='yeQgk'></legend><bdo id='yeQgk'><pre id='yeQgk'><center id='yeQgk'></center></pre></bdo></b><th id='yeQgk'></th></span></q></dt></tr></i><div id='yeQgk'><tfoot id='yeQgk'></tfoot><dl id='yeQgk'><fieldset id='yeQgk'></fieldset></dl></div>

      <small id='yeQgk'></small><noframes id='yeQgk'>

    1. <tfoot id='yeQgk'></tfoot>
      <legend id='yeQgk'><style id='yeQgk'><dir id='yeQgk'><q id='yeQgk'></q></dir></style></legend>
    2. ViewPager.setOffscreenPageLimit(0) 无法按预期工作

      ViewPager.setOffscreenPageLimit(0) doesn#39;t work as expected(ViewPager.setOffscreenPageLimit(0) 无法按预期工作)
        <bdo id='RpvL4'></bdo><ul id='RpvL4'></ul>

      • <legend id='RpvL4'><style id='RpvL4'><dir id='RpvL4'><q id='RpvL4'></q></dir></style></legend>
          • <small id='RpvL4'></small><noframes id='RpvL4'>

          • <i id='RpvL4'><tr id='RpvL4'><dt id='RpvL4'><q id='RpvL4'><span id='RpvL4'><b id='RpvL4'><form id='RpvL4'><ins id='RpvL4'></ins><ul id='RpvL4'></ul><sub id='RpvL4'></sub></form><legend id='RpvL4'></legend><bdo id='RpvL4'><pre id='RpvL4'><center id='RpvL4'></center></pre></bdo></b><th id='RpvL4'></th></span></q></dt></tr></i><div id='RpvL4'><tfoot id='RpvL4'></tfoot><dl id='RpvL4'><fieldset id='RpvL4'></fieldset></dl></div>

            1. <tfoot id='RpvL4'></tfoot>
                <tbody id='RpvL4'></tbody>

                本文介绍了ViewPager.setOffscreenPageLimit(0) 无法按预期工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我在 ViewPager 实例中使用的片段非常耗费资源,所以我只想一次加载一个.当我尝试以下操作时:

                The fragments I use in my ViewPager instance are quite resource intensive, so I'd only like to load one at a time. When I try the following:

                mViewPager.setOffscreenPageLimit(0);
                mViewPager.setAdapter(mPagerAdapter);
                

                我的 FragmentStatePagerAdapter.getItem(int position) 覆盖函数被调用了 3 次,这就是我调用 mViewPager.setOffscreenPageLimit(1) 时发生的情况.我希望它只被调用一次,因为我指定了 0 个屏幕外页面.

                My FragmentStatePagerAdapter.getItem(int position) override function is called 3 times, which is what happens when I call mViewPager.setOffscreenPageLimit(1). I would expect it to only be called once, because I specified 0 offscreen pages.

                我相信我正确调用了所有内容,因为如果我调用 mViewPager.setOffscreenPageLimit(2)FragmentStatePagerAdapter.getItem(int position) 会被调用 5 次会期望.

                I believe I'm calling everything correctly, because if I call mViewPager.setOffscreenPageLimit(2), FragmentStatePagerAdapter.getItem(int position) is called 5 times as I would expect.

                ViewPager 是否需要至少 1 个屏幕外页面,或者我在这里做错了什么?

                Does ViewPager require a minimum of 1 offscreen pages, or am I doing something wrong here?

                推荐答案

                ViewPager 是否需要至少 1 个屏幕外页面

                Does ViewPager require a minimum of 1 offscreen pages

                是的.如果我正确阅读了源代码,您应该会在 LogCat 中收到关于此的警告,例如:

                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
                

                这篇关于ViewPager.setOffscreenPageLimit(0) 无法按预期工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                How can I use CClistview in COCOS2d Android?(如何在 COCOS2d Android 中使用 CClistview?)
                cocos2d-android: how to display score(cocos2d-android:如何显示分数)
                Sqlite database not copied from asset folder Android(Sqlite 数据库未从资产文件夹 Android 复制)
                SQLite Database Copy Appears Corrupted When Generated by Device and not Emulator(SQLite 数据库副本在由设备而不是模拟器生成时出现损坏)
                Android file copy(安卓文件拷贝)
                Android how to detect Copy event of Edittext in android(Android如何在android中检测Edittext的Copy事件)
                  <tbody id='o47ug'></tbody>

              1. <legend id='o47ug'><style id='o47ug'><dir id='o47ug'><q id='o47ug'></q></dir></style></legend>
                • <bdo id='o47ug'></bdo><ul id='o47ug'></ul>

                  1. <i id='o47ug'><tr id='o47ug'><dt id='o47ug'><q id='o47ug'><span id='o47ug'><b id='o47ug'><form id='o47ug'><ins id='o47ug'></ins><ul id='o47ug'></ul><sub id='o47ug'></sub></form><legend id='o47ug'></legend><bdo id='o47ug'><pre id='o47ug'><center id='o47ug'></center></pre></bdo></b><th id='o47ug'></th></span></q></dt></tr></i><div id='o47ug'><tfoot id='o47ug'></tfoot><dl id='o47ug'><fieldset id='o47ug'></fieldset></dl></div>
                    <tfoot id='o47ug'></tfoot>

                          <small id='o47ug'></small><noframes id='o47ug'>