先看界面:
![](https://img.haomeiwen.com/i6461854/e926f359301ff6f3.png)
布局是很简单的这里就不贴了
冲突点是我知道我右边 有超过 6条数据的 但向上滑动的时候 右这的ReyclerView
滑不动
解决办法:内部拦截方法(自定义ReyclcerView) 我们知道事件分发分为内部拦截和外部拦截
关键点是 找到 BottomSheetDialogFragment 的 CoordinatoryLayout节点
![](https://img.haomeiwen.com/i6461854/d31cd29f9da96462.png)
然后告诉它 不要拦截自己
public class BottomSheetDialogFragmentConflictRecyclerView extends RecyclerView {
public BottomSheetDialogFragmentConflictRecyclerView(@NonNull Context context) {
super(context);
}
public BottomSheetDialogFragmentConflictRecyclerView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public BottomSheetDialogFragmentConflictRecyclerView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
// switch (ev.getAction()) {
// case MotionEvent.ACTION_DOWN:
// break;
// case MotionEvent.ACTION_MOVE:
// break;
// case MotionEvent.ACTION_UP:
// case MotionEvent.ACTION_CANCEL:
// break;
// }
getParent().getParent().getParent().getParent().getParent().requestDisallowInterceptTouchEvent(true);
return super.dispatchTouchEvent(ev);
}
}
网友评论