ScrollView inside ViewPager: swipe not working

后端 未结 3 1406
一个人的身影
一个人的身影 2021-01-06 21:44

I have ViewPager with three fragments and one of them is FrameLayout with ScrollView inside:



        
3条回答
  •  执笔经年
    2021-01-06 22:07

    The problem is that it isn't clear what scroll you want to happen, that of the ViewPager or that of the scrollview. If you really need a scroll-inside-a-scroll, then you need to override the OnTouchListener of the inner scrollview and add code that decides when to catch and use the touch, and when to pass it back to the parent views.

    In this case, you can do something that tests if the swipe is up/down, and then keep the touch, otherwise if the swipe is sideways then passes it back.

提交回复
热议问题