onPageScrollStateChanged(int state): what does state represent

Viewed 472

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 Answers

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

Related