问题
I have a parent ViewPager, each page of which contains a child ViewPager.
Child ViewPager may contain a ListView or a vertical ScrollView.
I want to pass horizontal scroll from child ViewPager to parent ViewPager, but want to keep child ViewPager scrollable vertical.
Overriding dispatchTouchEvent(MotionEvent event) in child ViewPager and returning false helps to pass motion events to parent ViewPager, but how to keep ListView and ScrollView in child ViewPager scrollable?
回答1:
The solution was easier than I expected.
Just override canScrollHorizontally in child ViewPager and return false.
来源:https://stackoverflow.com/questions/33463804/viewpager-inside-viewpager-how-to-scroll-parent-pager-horizontally-instead-of-sc