2014年3月15日

Android对touch事件的拦截,在View Tree上的传递顺序

摘要: 当发生touch事件时,系统会产生一个MotionEvent并且沿着ViewTree开始传递。首先获取MotionEvent是ViewTree的根节点,根节点通常是一个ViewGroup,ViewGroup将在onInterceptTouchEvent()中获取MotionEvent并决定是否继续向下传递。当在ViewGroup.onInterceptEvent()中返回true时,将截获MotionEvent,ViewTree下面的View将无法获得MotionEvent,转而交给当前ViewGroup的onTouchEvent()方法。如果onTouchEvent中返回false,那... 阅读全文

posted @ 2014-03-15 14:34 albert1017 阅读(3445) 评论(0) 推荐(0)

导航