當發生touch事件時,系統會產生一個MotionEvent並且沿着View Tree開始傳遞。首先獲取MotionEvent是View Tree的根節點,根節點通常是一個ViewGroup,ViewGroup將在onInterceptTouchEvent()中獲取MotionEvent並決定是否繼續向下傳遞。當在ViewGroup.onInterceptEvent()中返回true時,將截獲MotionEvent,View Tree下面的View將無法獲得MotionEvent,轉而交給當前ViewGroup的onTouchEvent()方法。如果onTouchEvent中返回false,那么MotionEvent將沿着View Tree向上傳給上一層。攔截的過程草圖如下:
參考地址:http://blog.csdn.net/chenshaoyang0011/article/details/7845434