setCurrentItem

open fun setCurrentItem(item: Int)(source)

Set the currently selected page. If the ViewPager has already been through its first layout with its current adapter there will be a smooth animated transition between the current item and the specified item. Silently ignored if the adapter is not set or empty. Clamps item to the bounds of the adapter.

Parameters

item

Item index to select


open fun setCurrentItem(item: Int, smoothScroll: Boolean)(source)

Set the currently selected page. If smoothScroll = true, will perform a smooth animation from the current item to the new item. Silently ignored if the adapter is not set or empty. Clamps item to the bounds of the adapter.

Parameters

item

Item index to select

smoothScroll

True to smoothly scroll to the new item, false to transition immediately