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

海外网站cdn加速网站建设公司论坛

海外网站cdn加速,网站建设公司论坛,国外做仿牌网站,济南建设网站公司MotionEvent 说明 完整touch event流程 Android用于描述动作的封装类。这里的动作不仅包含touch event#xff0c;还有如鼠标、手柄等不同输入设备所触发的动作#xff0c;下文以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_MOVEAndroid会将多个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:0TouchEvent事件分发一致性 在TouchEvent分发的流程中系统不能保证一个MotionEvent保持不变其可能被修改或删除从而导致touch事件没有走完ACTION_DOWN-ACTION_MOVE-ACTION_UP的事件链。所以view在接受TouchEvent的时候应当考虑ACTION_CACEL的情况或者没有收到ACTION_UP的情况下传来ACTION_DOWN 参考 触摸事件【MotionEvent】简介
http://www.hyszgw.com/news/111262/

相关文章:

  • 西安手机网站建设公司各种软件开发定制
  • 网站开发中遇到哪些问题西安网站开发的空间
  • 3800给做网站个人网站设计论文道客巴巴
  • 网站建设项目标书野花社区在线观看高清视频动漫
  • 医疗器械公司网站备案怎么做环球网最新国际新闻
  • 电子网站开发天津河东做网站
  • 多个 wordpressseo建设者
  • 个人旅游网站模版wordpress 调用页面列表
  • wordpress投票插件wp-polls北京seo课程
  • 邮箱号码大全河南seo外包
  • 许昌做网站公司免费空间搭建免费小说网站
  • 图片怎么做网站背景wordpress 主题 the7
  • 胶州做网站河南住房和城乡建设厅官网
  • 福田网站建设公司乐云seowordpress弹出搜索结果
  • 聊城市建设工程质量监督站网站在线生成个人网站
  • 网站建设项目策划宠物网站开发
  • 购物网站建设目标概述文库类网站建设建议及经验
  • 网站的点击率怎么查河南seo推广公司
  • 哪个程序做下载网站好湖南网站建设公
  • 提供邢台专业做网站wordpress推荐商品主题
  • 专业做网站制作自助建站系统商品展示网站模板源码
  • 网站建站加盟美食静态网站设计论文
  • 苏州网联盛网站建设惠州公司做网站
  • 北京首钢建设有限公司网站建设网站平台需要的设备
  • 做移动网站多少钱百度热议排名软件
  • 专业手机网站设计申请自助建站
  • 杭州电商网站建设全能浏览器app下载
  • 什么叫网站索引wordpress分类排序号
  • 我是做颗粒在什么网站上京东联盟网站建设电脑版
  • 网站空间购买全国企业信用信息