Two synchronized scrolling ViewPagers

I need to synchronize scrolling in two view modes.

Here is the code:

super.onTouchEvent(ev);
    switch (ev.getAction()) {
    case MotionEvent.ACTION_DOWN:
        mViewPager.beginFakeDrag();
        return true;
    case MotionEvent.ACTION_MOVE:
        mViewPager.fakeDragBy(mViewPager.getScrollX()-getScrollX());
        return true;

    case MotionEvent.ACTION_UP:
    case MotionEvent.ACTION_CANCEL:
        mViewPager.endFakeDrag();
        return true;
    default:
        break;
    }
    return mViewPager.onTouchEvent(ev);

I get a touch event and scroll the second view for the same amount. But one thing that I can’t handle is to disable or process the throw in the same way, I mean a short quick gestrue that automatically allows you to scroll to the next page.

Structure -ViewPagerNavigator- -ViewPagerMenu -

How do I throw in it to work with a menu pager or just turn it off?

+3
source share
2 answers

As before:

, , ViewPager.OnPageChangeListener? , , , onPageScrolled(...) . flings onPageSelected(...).

+1
0

All Articles