View 的事件分发

事件分发的伪代码

1
2
3
4
5
6
7
8
9
10
11
12
13
boolean dispatchTouchEvent(MomentEvent ev){
boolean consume = false;
if(onInterceptTouchEvent(ev)){
//该 View 进行拦截
consume = onTouchEvent(ev);
}else{
consume = child.dispatchTouchEvent(ev);
}

returen consume;

}

阅读更多