SmartRefreshLayout 和ViewPager2 的滑动冲突还么解决吗

cigdeys3  于 2个月前  发布在  其他
关注(0)|答案(3)|浏览(37)

SmartRefreshLayout 和 ViewPager2 使用回在 刷新头/尾的时候 action_up 事件 导致Viewpager2 滑动 。

eaf3rand

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.

相关问题