Touch事件传递的实验

通过自定义的Relayout   LinearLayout   TextView ,

布局为:
 
 
分别打印事件方法:
1.当所有的都是super的时候,点击TextView的时候,事件的传递是:
此时,我再TextView上随意的滑动,是没有任何的事件过程的。
   2)如果我在TextView的OntouchEvent中返回true,则事件传递:
        
           一直的做循环。
 3)如果我在TextView的OntouchEvent中返回false,则事件传递:
    结果跟1.1是一样的
   4)如果我在TextView的dispatchtouchevent中返回true,ontouchevent中返回super  则事件传递:
    
    5)如果我在TextView的dispatchtouchevent中返回false,ontouchevent中返回super  则事件传递:
            
  根本就不会进入onTouchEvent事件
 
 
 
2. 当点击LinearLayout的时候  事件的传递:
   2)如果我在LinearLayout的dispatchTouchEvent中返回true,则事件传递:
        
            3)如果我在LinearLayout的dispatchTouchEvent中返回false,则事件传递:        
                
            4) 如果我在LinearLayout的dispatchTouchEvent中返回super   onintercepttouchevent返回true,则事件传递:
                
       4) 如果我在LinearLayout的dispatchTouchEvent中返回super   onintercepttouchevent返回false,则事件传递:
         
         5) 如果我在LinearLayout的dispatchTouchEvent中返回super   onintercepttouchevent返回super,  TouchEvent  返回true则事件传递:
            
 
 
 
 





原文地址:https://www.cnblogs.com/flyme2012/p/4047032.html