setPageIndex

open fun setPageIndex(@IntRange(from = 0) pageIndex: Int)

Sets the pageIndex to be displayed (0 is the first one), using our default decision on animating, which is to animate the transition if the page is next/before the current page, and not animate if further away. For custom animation control , use setPageIndex.

This method will throw an exception if pageIndex < 0 || pageIndex >= pageCount (as returned by getPageCount).

Parameters

pageIndex

Target page which should be displayed.


open fun setPageIndex(@IntRange(from = 0) pageIndex: Int, animated: Boolean)

Sets the pageIndex to be displayed (0 is the first one). If animated is set to true, the page jump will be animated. If false, the page will be shown immediately.

This method will throw an exception if pageIndex < 0 || pageIndex >= pageCount (as returned by getPageCount).

Parameters

pageIndex

Target page which should be displayed.

animated

Set to true, if a transitioning animation should be performed. Otherwise to false.