//记录上一次滑动的positionOffsetPixels值 private int lastValue = -1; private boolean isLeft = true; mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (positionOffset != 0) { if (lastValue >= positionOffsetPixels) { //右滑 isLeft = false; } else if (lastValue < positionOffsetPixels) { //左滑 isLeft = true; } setIndiactorView(positionOffset,isLeft); } lastValue = positionOffsetPixels; } @Override public void onPageSelected(int position) { if (isLeft){ Log.e("onPageScrolled","--->左划"); }else { Log.e("onPageScrolled","--->右划"); } } @Override public void onPageScrollStateChanged(int state) { } });