自定义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"