您好,欢迎来到二三四教育网。
搜索
您的当前位置:首页android触摸事件分发机制1

android触摸事件分发机制1

来源:二三四教育网

Activity->ViewGroup->View   event process

eg:

xml:

code:

TestViewGroup

TestView

touch log:

fenxi log:

MainActivity:dispathTouchEvent  (ActionDown)  

- > TestViewRoot:dispatchTouchEvent  (ActionDown)

->TestViewRoot:onInterceptTouchEvent (ActionDown) 

->TestView:dispathTouchEvent (ActionDown)

->ManActivity:Testview OnTouchListener onTouch  (ActionDown)

->TestView:onTouchEvent  (ActionDown) 

->MainActivity:dispatchTouchEvent (ActionUp)

->TestViewRoot:dispathcTouchEvent (ActionUp)

->TestViewRoot:onInterceptTouchEvent (ActionUp)

->TestView:dispatchTouchEvent (ActionUp)

->MainActivity: TestView onTouchListener onTouch  (ActionUp)

-> TestView:onTouchEvent

->MainAvtivity: TestView onClickListener onClick

if  TestViewRoot:onInterceptTouchEvent  return true;

log below:

MainActivity:dispatchTouchEvent (ActionDown)

->TestViewRoot :dispatchTouchEvent (ActionDown)

->TestViewRoot onInterceptTouchEvent (ActionDown)

-> TestViewRoot onTouchEvent (ActiondonDown)

->MainActivity: onTouchEnvent (ActionDown)

->MainActivity: dispatchTouchEvent (ActionUp)

->MainActivity:onTouchEvent (ActonUp)

we see intercept TestView (view child) touch event

requestDisallowInterceptTouchEvent .   is not work

now we see  Activity dispatchTouchEvent

Copyright © 2019- how234.cn 版权所有 赣ICP备2023008801号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务