android / views-widgets-samples

Multiple samples showing the best practices in views-widgets on Android.
Apache License 2.0
5.04k stars 3.01k forks source link

嵌套的fragment向上滑动 #95

Open PostLiu opened 4 years ago

PostLiu commented 4 years ago

RadioGroup+ViewPager2+Fragment,手指快速往上滑动,会导致ViewPager2的左右切换

jfresen commented 4 years ago

Hi, are there any other views in the hierarchy that handle swipe gestures? For example, a ViewPager2 that is a descendent of a SwipeRefreshLayout, or a RecyclerView that is a child of ViewPager2, or any combination?

PostLiu commented 4 years ago

本来也是如此认为的,当我去构建一个demo,一个Activity里使用RadioGroup+ViewPager2+Fragment,创建3个空的Fragment,然后关联,手指在fragment里上下滑动,也会出现这种左右切换的情况

PostLiu commented 4 years ago

Hi, are there any other views in the hierarchy that handle swipe gestures? For example, a ViewPager2 that is a descendent of a SwipeRefreshLayout, or a RecyclerView that is a child of ViewPager2, or any combination?

同样的握持手机,手指的上下滑动,ViewPager不会出现这种切换的情况,ViewPager2由于继承了RecyclerView的一些处理,是否跟这个有关