Search code examples
javaandroidandroid-viewpager

Jump instantly with ViewPager


I have a tabbed ViewPager which lets the user jump to the corresponding page depending on which tab they press. The problem is that you see the view pager scroll really quickly to the selected page, meaning you get small glimpses of each its scrolls through. Is there a way to stop this and jump instantly without seeing other pages.


Solution

  • Call setCurrentItem(itemPosition, false) on your ViewPager instance. As per the documentation the second parameter is smoothScroll effect which causes the glimpses of the other fragments.