`onPageScrollStateChanged(int state)`:state 代表什么内容。

huangapple go评论100阅读模式
英文:

onPageScrollStateChanged(int state): what does state represent

问题

每当我在我的ViewPager上使用.registerOnPageChangeCallback时,会调用3个方法,其中一个是onPageScrollStateChanged,我想知道变量state代表什么?

英文:

Whenever I set .registerOnPageChangeCallback on my viewpager 3 methods are called, one of them is onPageScrollStateChanged, I want to know what is the variable state represents?

答案1

得分: 3

  1. 来自文档:
  2. >
  3. > `public static final int SCROLL_STATE_DRAGGING`
  4. >
  5. > 表示 ViewPager2 当前正被用户拖动,或者通过虚拟拖动功能在程序中进行拖动。
  6. >
  7. > 常量值:1 (0x00000001)
  8. >
  9. > `public static final int SCROLL_STATE_IDLE`
  10. >
  11. > 表示 ViewPager2 处于空闲、稳定状态。当前页面完全可见,没有动画正在进行。
  12. >
  13. > 常量值:0 (0x00000000)
  14. >
  15. > `public static final int SCROLL_STATE_SETTLING`
  16. >
  17. > 表示 ViewPager2 正在过渡到最终位置的过程中。
  18. >
  19. > 常量值:2 (0x00000002)
  20. 更多内容请查阅 [文档链接][1]
  21. [1]: https://developer.android.com/reference/androidx/viewpager2/widget/ViewPager2.OnPageChangeCallback
英文:

From documentation:

>
> public static final int SCROLL_STATE_DRAGGING
>
> Indicates that the ViewPager2 is currently being dragged by the user,
> or programmatically via fake drag functionality.
>
> Constant Value: 1 (0x00000001)
>
> public static final int SCROLL_STATE_IDLE
>
> Indicates that the ViewPager2 is in an idle, settled state. The
> current page is fully in view and no animation is in progress.
>
> Constant Value: 0 (0x00000000)
>
> public static final int SCROLL_STATE_SETTLING
>
> Indicates that the ViewPager2 is in the process of settling to a final
> position.
>
> Constant Value: 2 (0x00000002)

For more check Documentation

huangapple
  • 本文由 发表于 2020年5月29日 21:09:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/62086771.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定