每当我在 viewpager 上设置 .registerOnPageChangeCallback 时,都会调用 3 个方法,其中之一是 onPageScrollStateChanged,我想知道变量 state 代表什么?
最佳答案
来自文档:
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)
更多信息请查看Documentation
关于java - onPageScrollStateChanged(int状态): what does state represent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62086771/