先看一下调试的堆栈信息
MainActivity的dispatchTouchEvent的方法定义如下
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
return super.dispatchTouchEvent(event);
}
从堆栈信息可以看出调用MainActivity的地方在
PhoneWindow$DecorView.dispatchTouchEvent(MotionEvent) line: 1918
查看源码 其中Callback 、DecorView都是Window的一个内部类
public abstract class Window {
/**
* Set the Callback interface for this window, used to intercept key
* events and other dynamic operations in the window.
*
* @param callback The desired Callback interface.
*/
public void setCallback(Callback callback) {
mCallback =