onPageScrollStateChanged(int state):state代表什么

onPageScrollStateChanged(int state): what does state represent

每当我在 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