SmartRefreshLayout icon indicating copy to clipboard operation
SmartRefreshLayout copied to clipboard

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

Open liudaohong opened this issue 4 years ago • 3 comments

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

liudaohong avatar Feb 04 '21 06:02 liudaohong

可以试试我的解决方法:https://www.jianshu.com/p/3fb3f1bc6ebb

TReturn avatar Aug 27 '21 14:08 TReturn

解决了吗

liuzhenhang avatar Oct 29 '21 02:10 liuzhenhang

通过反射 修改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, touchSlop*4);//通过获取原有的最小滑动距离 *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.

liudaohong avatar Oct 29 '21 02:10 liudaohong