英文:
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
来自文档:
>
> `public static final int SCROLL_STATE_DRAGGING`
>
> 表示 ViewPager2 当前正被用户拖动,或者通过虚拟拖动功能在程序中进行拖动。
>
> 常量值:1 (0x00000001)
>
> `public static final int SCROLL_STATE_IDLE`
>
> 表示 ViewPager2 处于空闲、稳定状态。当前页面完全可见,没有动画正在进行。
>
> 常量值:0 (0x00000000)
>
> `public static final int SCROLL_STATE_SETTLING`
>
> 表示 ViewPager2 正在过渡到最终位置的过程中。
>
> 常量值:2 (0x00000002)
更多内容请查阅 [文档链接][1]
[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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论