Is it possible to know the direction of the scroll in the method onPageScrolled
of the OnPageChangeListener
applied to a ViewPager
?
I've used something like this:
mPager.setOnPageChangeListener(new OnPageChangeListener() {
int oldPos = mPager.getCurrentItem();
@Override
public void onPageScrolled(int position, float arg1, int arg2) {
if(position > oldPos) {
//Moving to the right
} else if(position < oldPos) {
//Moving to the Left
}
.
.
.
--Edit--
Sorry, changed to onPageScrolled, not onPageSelected..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With