调用顺序1——>5
1.dispatchTouchEvent 返回值true
2onInterceptTouchEvent 只存在月viewgroup中,view中没有。返回值true
3onTouch 不一定有,控件可点击,且设置setOnTouchListener才会调用
4onTouchEvent 返回值true
5onClick 在onTouchEvent里面调用
getParent().requestDisallowInterceptTouchEvent(false);

public boolean dispatchTouchEvent(MotionEvent ev){
boolean handle = false;
if(onInterceptTouchEvent(ev)){
handle = onTouchEvent(ev);
}else{
handle = child.dispatchTouchEvent(ev);
}
return handle;
}

网友评论