当前位置: 首页 > news >正文

做视频网站视频源网址域名查询ip地址

做视频网站视频源,网址域名查询ip地址,襄阳企业网站建设,做软件网站MotionEvent 说明 完整touch event流程 Android用于描述动作的封装类。这里的动作不仅包含touch event,还有如鼠标、手柄等不同输入设备所触发的动作,下文以touch event为例。 该类将一个动作描述为动作码action code和一些系列坐标值。当手指触碰屏幕…

MotionEvent 说明

完整touch event流程

Android用于描述动作的封装类。这里的动作不仅包含touch event,还有如鼠标、手柄等不同输入设备所触发的动作,下文以touch event为例。
该类将一个动作描述为动作码action code和一些系列坐标值。当手指触碰屏幕时,首先产生动作码为ACTION_DOWN的MotionEvent,随后ACTION_MOVE记录手指在屏幕上的滑动信息,当手指离开屏幕时产生ACTION_UP,此时一个touch event就正常结束了。但是不能保证每个touch event都能顺利结束,可能出现touch event被取消,此时会收到一个带有ACTION_CANCEL的MotionEvent。

Event ACTION_DOWN
Event ACTION_MOVE
Event ACTION_MOVE
Event ACTION_MOVE
Event ACTION_MOVE
Event ACTION_UP

支持多点触碰

Android引入了pointer来描述每一个触碰点。一个MotionEvent中可以同时存在多个pointer,当已经有手指触碰屏幕后,每多一个手指触碰屏幕,对应增加一个pointer。为了区分不同的pointer,每个pointer都带有一个id,并且保证id在整个touch event有效期间保持不变。

I/history: --------------once history start!-----------
I/history: At time 87122940
I/history: pointer 0: (650.0,593.0)
I/history: pointer 1: (278.0,878.0)
I/history: At time 87122948
I/history: pointer 0: (653.0,614.0)
I/history: pointer 1: (281.0,904.0)
I/history: At time 87122957
I/history: pointer 0: (658.0,642.0)
I/history: pointer 1: (284.0,934.0)
I/history: At time 87122965
I/history: pointer 0: (661.0,670.0)
I/history: pointer 1: (289.0,968.0)
I/history: Current time :87122969
I/history: pointer 0: (661.4655,685.3621)
I/history: pointer 1: (290.8621,983.3622)
I/history: --------once history finish--------- 
I/history: --------------once history start!-----------
I/history: At time 87122973
I/history: pointer 0: (662.0,703.0)
I/history: pointer 1: (293.0,1001.0)
I/history: At time 87122982
I/history: pointer 0: (664.0,737.0)
I/history: pointer 1: (297.0,1038.0)
I/history: Current time :87122989
I/history: pointer 0: (664.0,765.4084)
I/history: pointer 1: (298.7755,1062.8573)
I/history: --------once history finish--------- 

对于ACTION_MOVE,Android会将多个ACTION_MOVE集合在一个MotionEvent中。以下是源码中给出的按时间顺序查看MotionEvent中全部pointer代码,运行结果见上。

    void printSamples(MotionEvent ev) {final int historySize = ev.getHistorySize();final int pointerCount = ev.getPointerCount();Log.i("history", "--------------once history start!-----------");for (int h = 0; h < historySize; h++) {Log.i("history","At time "+ev.getHistoricalEventTime(h) );for (int p = 0; p < pointerCount; p++) {Log.i("history","index "+ev.findPointerIndex(p)+" pointer "+ev.getPointerId(p)+": ("+ev.getHistoricalX(p, h)+","+ev.getHistoricalY(p, h)+")");}}Log.i("history","Current time :"+ev.getEventTime());for (int p = 0; p < pointerCount; p++) {Log.i("history","index "+ev.findPointerIndex(p)+" pointer "+ev.getPointerId(p)+": ("+ ev.getX(p)+","+ev.getY(p)+")");}Log.i("history", "--------once history finish--------- ");}

MotionEvent数据获取

MotionEvent中提供很多方法来获取event相关属性,如坐标、压力信息等。但是MotionEvent类中大多数方法接受的是event的index,而不是id。根据源码注释,pointer是无序出现的,所以如果想要追踪某一touch evnet,需要在ACTION_DOWN时记录该event的id,在后续通过getPointerId(int)方法来获取index

I/POINTER: pointer index:0 pointer id:0
I/POINTER: pointer index:0 pointer id:0
I/POINTER: pointer index:0 pointer id:1
I/POINTER: pointer index:0 pointer id:1
I/POINTER: pointer index:0 pointer id:0
I/POINTER: pointer index:0 pointer id:0

TouchEvent事件分发一致性

在TouchEvent分发的流程中,系统不能保证一个MotionEvent保持不变,其可能被修改或删除,从而导致touch事件没有走完ACTION_DOWN-ACTION_MOVE-ACTION_UP的事件链。所以view在接受TouchEvent的时候应当考虑ACTION_CACEL的情况,或者没有收到ACTION_UP的情况下传来ACTION_DOWN

参考

触摸事件【MotionEvent】简介

http://www.hkea.cn/news/25353/

相关文章:

  • php做网站csdn网站seo公司哪家好
  • 今日头条建站工具何鹏seo
  • wordpress 培训模板优化落实疫情防控新十条
  • 关于做外汇现货的网站太原整站优化排名外包
  • 星悦做任务网站是新网站百度收录
  • 十大营销网站seo关键词查询工具
  • 怎么查询网站所有关键词靠谱的广告联盟
  • 超酷的网站设计磁力搜索引擎
  • 网站建设写程序用什么软件成都疫情最新消息
  • 做网站需要什么资金2022今天刚刚发生地震了
  • 建设网站费用主要包括哪些google商店
  • 专注邯郸建设手机网站贴吧友情链接在哪
  • 网站备案拍照背景志鸿优化网官网
  • 网站百度知道怎么做推广网站搜索引擎优化的方法
  • 网站建设注意哪些问题sem和seo是什么职业岗位
  • 一_建设网站前的市场分析奶茶软文案例300字
  • 做网站智能工具江阴企业网站制作
  • 怎么看网站有没有做推广大数据营销系统多少钱
  • 广东工厂搜索seoseo平台优化服务
  • 网站开发平台 eclipseseo网站推广案例
  • 什么网站做调查能赚钱关键词优化报价推荐
  • 网站开发职业认知小结开发一个app平台大概需要多少钱?
  • 装修公司全包项目seo搜索引擎实训心得体会
  • 爱站网是干什么的长沙关键词排名首页
  • wordpress 教垜四川seo推广公司
  • 东莞市阳光网青岛seo服务
  • 网站弹窗在中间位置企业培训师
  • 整站下载器 安卓版域名解析查询站长工具
  • 跨境自建站模板seo推广是做什么
  • 网站建设与网页设计报告网络营销师报名入口