Controlling two ViewPager Together
android, android-layout, android-scroll, android-scrollview, android-viewpager
Solution
I think this is what you need:
viewpager1.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
viewpager2.onTouchEvent(event);
return false;
}
});
viewpager2.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
viewpager1.onTouchEvent(event);
return false;
}
});
I have a same problem, but first I try to use fakeDragBy method, which is dead end. (if you have more than two pages)
Problem
I need to synchronize the two ViewPager together. The requirement is something like on scrolling the ViewPager-1 and the ViewPager-2 should also scroll by certain amount. The Image shown below will make you more clear with my question. You can also help me with some tutorials link. Thanks.