I did this using reflection. By setting a private field mMinimumVelocity
to -1
, you make the ViewPager take all your scrolls as a fling scroll - which needs much shorter drag to switch to the next page. Works like a charm!
Field mMinimumVelocity;
mMinimumVelocity = ViewPager.class.getDeclaredField("mMinimumVelocity");
mMinimumVelocity.setAccessible(true);
mMinimumVelocity.set(mPager, -1);
The source code from which I know the private fields is here.
Also if you want to make the threshold a little bigger than the default 25dp of the fling scroll, you can set the mFlingDistance
field to some higher value, e.g. 45dp. But remember it also affects the required drag distance of the actual fling scroll.
Field mFlingDistance;
mFlingDistance= ViewPager.class.getDeclaredField("mFlingDistance");
mFlingDistance.setAccessible(true);
mFlingDistance.set(mPager, (int) (45 * context.getResources().getDisplayMetrics().density));