通过反射 修改View 的最小滑动距离来处理的 在使用前调用 /** * 改变ViewPager2的滑动系数 * / public static void changeViewPaer2 (ViewPager2 vp){ try { final Field recyclerViewField = ViewPager2.class.getDeclaredField("mRecyclerView"); recyclerViewField.setAccessible(true); final RecyclerView recyclerView = (RecyclerView) recyclerViewField.get(vp);//vb.viewpagerHome为要改变滑动距离的viewpager2控件 final Field touchSlopField = RecyclerView.class.getDeclaredField("mTouchSlop"); touchSlopField.setAccessible(true); final int touchSlop = (int) touchSlopField.get(recyclerView); touchSlopField.set(recyclerView, touchSlop4);//通过获取原有的最小滑动距离 *n来增加此值 //touchSlopField.set(recyclerView, 200);//自己写一个值 } catch (Exception ignore) { } }…
------------------ 原始邮件 ------------------ 发件人: "scwang90/SmartRefreshLayout" ***@***.***>; 发送时间: 2021年10月29日(星期五) 上午10:08 ***@***.***>; ***@***.******@***.***>; 主题: Re: [scwang90/SmartRefreshLayout] 和ViewPager2 的滑动冲突还么解决吗 (#1305) 解决了吗 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
3条答案
按热度按时间hfwmuf9z1#
可以试试我的解决方法: https://www.jianshu.com/p/3fb3f1bc6ebb
iaqfqrcu2#
解决了吗
eaf3rand3#
通过反射 修改View 的最小滑动距离来处理的 在使用前调用 /** * 改变ViewPager2的滑动系数 * / public static void changeViewPaer2 (ViewPager2 vp){ try { final Field recyclerViewField = ViewPager2.class.getDeclaredField("mRecyclerView"); recyclerViewField.setAccessible(true); final RecyclerView recyclerView = (RecyclerView) recyclerViewField.get(vp);//vb.viewpagerHome为要改变滑动距离的viewpager2控件 final Field touchSlopField = RecyclerView.class.getDeclaredField("mTouchSlop"); touchSlopField.setAccessible(true); final int touchSlop = (int) touchSlopField.get(recyclerView); touchSlopField.set(recyclerView, touchSlop4);//通过获取原有的最小滑动距离 *n来增加此值 //touchSlopField.set(recyclerView, 200);//自己写一个值 } catch (Exception ignore) { } }…
------------------ 原始邮件 ------------------ 发件人: "scwang90/SmartRefreshLayout" ***@***.***>; 发送时间: 2021年10月29日(星期五) 上午10:08 ***@***.***>; ***@***.******@***.***>; 主题: Re: [scwang90/SmartRefreshLayout] 和ViewPager2 的滑动冲突还么解决吗 (#1305) 解决了吗 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.