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

        • <bdo id='ug4rB'></bdo><ul id='ug4rB'></ul>
        <tfoot id='ug4rB'></tfoot>
      1. 如何知道 viewpager 是向左还是向右滚动?

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

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

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

                  <tbody id='EzERk'></tbody>

                  本文介绍了如何知道 viewpager 是向左还是向右滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 ViewPager(支持库).我想知道每次 ViewPager 更改可见页面时,它是向左还是向右滚动.

                  I am using ViewPager (support library). I want to know every time the ViewPager change the visible page, it is scrolling left or right.

                  请给我一个解决方案.也欢迎任何推荐.

                  Please give me a solution. Any recommend is welcome also.

                  谢谢

                  推荐答案

                  设置 setOnPageChangeListener 到你的 ViewPager

                  保持一个全局变量为

                  private int lastPosition = 0;
                  

                  @Override
                  public void onPageSelected(int arg0) {
                      if (lastPosition > position) {
                           System.out.println("Left");
                        }else if (lastPosition < position) {
                           System.out.println("Right");
                        }
                        lastPosition = position;
                  }
                  

                  这篇关于如何知道 viewpager 是向左还是向右滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在TabLayout(材料设计)android中动态添加和删除标签 下一篇:从 Bool 数组返回索引值数组,其中 true

                  相关文章

                  1. <tfoot id='zHqGe'></tfoot>

                      <bdo id='zHqGe'></bdo><ul id='zHqGe'></ul>
                  2. <small id='zHqGe'></small><noframes id='zHqGe'>

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