• <tfoot id='EEcwL'></tfoot>

  • <legend id='EEcwL'><style id='EEcwL'><dir id='EEcwL'><q id='EEcwL'></q></dir></style></legend>
      <bdo id='EEcwL'></bdo><ul id='EEcwL'></ul>

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

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

        android Viewpager 一次只加载一页

        时间:2023-10-04
          <legend id='GNINZ'><style id='GNINZ'><dir id='GNINZ'><q id='GNINZ'></q></dir></style></legend>
        1. <tfoot id='GNINZ'></tfoot>
        2. <small id='GNINZ'></small><noframes id='GNINZ'>

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

                  <bdo id='GNINZ'></bdo><ul id='GNINZ'></ul>
                    <tbody id='GNINZ'></tbody>
                  本文介绍了android Viewpager 一次只加载一页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  ViewPager.setOffscreenPageLimit(0) 无法按预期工作

                  喜欢这个问题.但我需要一个自定义的 Viewpager 来按时加载一页.有例子吗?

                  Like the question. But I need a custom Viewpager which load one page on time. Is there any example?

                  推荐答案

                  是的,您可以通过以下步骤做到这一点

                  Yes you can do this with following steps

                  • 首先在适配器类中创建一个count变量
                  • ViewPager 适配器中创建一个 public 函数说 setCount()
                  • 并且在Adapter return的重写getCount()函数中count变量
                  • 现在overrideViewPagerpageScroll()函数当用户翻页可以调用setCount()增加count计数变量
                  • 还要检查当前的 index 是否是最后一个页面是否是向左滚动
                  • First create a count variable in the adapter class
                  • second in the ViewPager Adapter make a public function say setCount()
                  • and in the override getCount() function of Adapter return the count variable
                  • now override the on pageScroll() function of the ViewPager when the user flips the page you can call the setCount() to increase the count of the count variable
                  • also check that if that the current index is last and page is scrolled to left

                  这应该可以.

                  这篇关于android Viewpager 一次只加载一页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:ListView 行内的 ViewPager 防止 onItemClick 被触发 下一篇:Android ViewPager 维度

                  相关文章

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

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

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

                      <tfoot id='bNw1S'></tfoot>