RecyclerView嵌套横向RecyclerView卡顿问题

xiaoxiao2021-02-28  32

自定义RecyclerView重写下面两个方法,屏蔽RecyclerView的滑动监听

 

@Override public boolean onInterceptTouchEvent(MotionEvent e) { //返回false,则把事件交给子控件的onInterceptTouchEvent()处理 return false; } @Override public boolean onTouchEvent(MotionEvent e) { //返回true,则后续事件可以继续传递给该View的onTouchEvent()处理 return true; } RecyclerView外面嵌套一层RecyclerView,高版本手机会出现显示内容不全,这样修改: <ScrollView android:layout_width="match_parent" android:layout_height="match_parent"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:descendantFocusability="blocksDescendants"> <com.tengying.tengying.myview.MyRecyclerView android:id="@+id/mainRecycleview" android:layout_width="match_parent" android:layout_height="match_parent" > </com.tengying.tengying.myview.MyRecyclerView> </RelativeLayout> </ScrollView> 如丝般顺滑!
转载请注明原文地址: https://www.6miu.com/read-2624697.html

最新回复(0)