作家
登录

一篇文章彻底搞懂Android事件分发机制

作者: 来源: 2017-07-21 09:11:30 阅读 我要评论

) target.mLeft;   
  •            final float yc = scrolledYFloat - (float) target.mTop;   
  •            mPrivateFlags &= ~CANCEL_NEXT_UP_EVENT;   
  •            ev.setAction(MotionEvent.ACTION_CANCEL);   
  •            ev.setLocation(xc, yc);   
  •               
  •            if (!target.dispatchTouchEvent(ev)) {   
  •            }   
  •            // clear the target   
  •            mMotionTarget = null;   
  •            // Don't dispatch this event to our own view, because we already   
  •            // saw it when intercepting; we just want to give the following   
  •            // event to the normal onTouchEvent().   
  •            return true;   
  •        }   
  •    
  •        if (isUpOrCancel) {   
  •            mMotionTarget = null;   
  •        }   
  •    
  •        // finally offset the event to the target's coordinate system and   
  •        // dispatch the event.   
  •        final float xc = scrolledXFloat - (float) target.mLeft;   
  •        final float yc = scrolledYFloat - (float) target.mTop;   
  •        ev.setLocation(xc, yc);   
  •    
  •        if ((target.mPrivateFlags & CANCEL_NEXT_UP_EVENT) != 0) {   
  •            ev.setAction(MotionEvent.ACTION_CANCEL);   
  •            target.mPrivateFlags &= ~CANCEL_NEXT_UP_EVENT;   
  •            mMotionTarget = null;   

  •   推荐阅读

      AgentWeb是基于Android WebView一个功能完善小型浏览器库

    【技巧沙龙】AI开辟者拭魅战营-7分钟打造1个定制技能。7月22号,我们等你一路! Android 端AgentWeb 介绍AgentWeb是一个高度封装的 Android WebView ,简单易用 , 带有进度条 、 支撑文>>>详细阅读


    本文标题:一篇文章彻底搞懂Android事件分发机制

    地址:http://www.17bianji.com/lsqh/36325.html

  • 关键词: 探索发现

    乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

    网友点评
    自媒体专栏

    评论

    热度

    精彩导读
    栏目ID=71的表不存在(操作类型=0)