Disabling animation in ViewPager

Here's another solution:

  • Subclass the ViewPager (your custom ViewPager)
  • Override the two setCurrentItem methods

Code Snippet:

@Override
public void setCurrentItem(int item, boolean smoothScroll) {
    super.setCurrentItem(item, false);
}

@Override
public void setCurrentItem(int item) {
    super.setCurrentItem(item, false);
}

By setting smoothScroll to false, you're disabling the scroll animation.


I finally found out: the issue can be solved by just calling the mViewPager.setCurrentItem(position) with an extra parameter to false, which is the smooth scroll for the ViewPager. After this, the scroll will be done without any smoothing and thus the animations won't be seen.