一个函数看懂View事件分发机制

/** 
     * Pass the touch screen motion event down to the target view, or this 
     * view if it is the target. 
     * 
     * @param event The motion event to be dispatched. 
     * @return True if the event was handled by the view, false otherwise. 
     */  
    public boolean dispatchTouchEvent(MotionEvent event) {  
        if (!onFilterTouchEventForSecurity(event)) {  
            return false;  
        }  
  
        if (mOnTouchListener != null && (mViewFlags & ENABLED_MASK) == ENABLED &&  
                mOnTouchListener.onTouch(this, event)) {  
            return true;  
        }  
        return onTouchEvent(event);  
    }

如果你没看懂,http://blog.csdn.net/lmj623565791/article/details/38960443 

你可能感兴趣的:(随笔记)