之前发现了如果两个可以移动的ViewGroup存在重叠的触摸区域,在触摸事件发生在这里面的时候,会产生冲突,乃至于产生不可预料的事件导致FC!!
还是重写这个方法
public boolean onInterceptTouchEvent(MotionEvent ev)
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (MotionEventCompat.getActionMasked(ev) == MotionEvent.ACTION_DOWN){
//如果在这个ViewGroup产生 "按下" 的事件时,则请求不拦截触摸事件
requestDisallowInterceptTouchEvent(true);
}else if (MotionEventCompat.getActionMasked(ev) == MotionEvent.ACTION_UP){
//如果在这个ViewGroup产生 "抬起" 的事件时,则允许拦截触摸事件
requestDisallowInterceptTouchEvent(false);
}
return !isINVISIBLE && dragHelper.shouldInterceptTouchEvent(ev);
}