private void setViewPagerScroller ( ) { try { Field scrollerField = ViewPager . class . getDeclaredField ( "mScroller" ) ; scrollerField . setAccessible ( true ) ; Field interpolatorField = ViewPager . class . getDeclaredField ( "sInterpolator" ) ; interpolatorField . setAccessible ( true ) ; scroller = new CustomDurationScroller ( getContext ( ) , ( Interpolator ) interpolatorField . get ( null ) ) ; scrollerField . set ( this , scroller ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } }
set ViewPager scroller to change animation duration when sliding