ViewPager2

public final class ViewPager2
extends ViewGroup

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ androidx.viewpager2.widget.ViewPager2


ViewPager2 replaces ViewPager, addressing most of its predecessor’s pain-points, including right-to-left layout support, vertical orientation, modifiable Fragment collections, etc.

See also:

Summary

Nested classes

class ViewPager2.OnPageChangeCallback

Callback interface for responding to changing state of the selected page. 

interface ViewPager2.PageTransformer

A PageTransformer is invoked whenever a visible/attached page is scrolled. 

Constants

int OFFSCREEN_PAGE_LIMIT_DEFAULT

Value to indicate that the default caching mechanism of RecyclerView should be used instead of explicitly prefetch and retain pages to either side of the current page.

int ORIENTATION_HORIZONTAL

int ORIENTATION_VERTICAL

int SCROLL_STATE_DRAGGING

Indicates that the ViewPager2 is currently being dragged by the user, or programmatically via fake drag functionality.

int SCROLL_STATE_IDLE

Indicates that the ViewPager2 is in an idle, settled state.

int SCROLL_STATE_SETTLING

Indicates that the ViewPager2 is in the process of settling to a final position.

Inherited constants

Inherited fields