VelocityTracker简要
參照自: http://blog.jrj.com.cn/4586793646,5298605a.html
android.view.VelocityTracker主要用跟踪触摸屏事件(flinging事件和其它gestures手势事件)的速率。用addMovement(MotionEvent)函数将Motion event增加到VelocityTracker类实例中.你能够使用getXVelocity() 或getXVelocity()获得横向和竖向的速率到速率时,可是使用它们之前请先调用computeCurrentVelocity(int)来初始化速率的单位
。
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| void |
addMovement(MotionEvent event)
Add a user's movement to the tracker.
|
||||||||||
| void |
clear()
Reset the velocity tracker back to its initial state.
|
||||||||||
| void |
computeCurrentVelocity(int units, float maxVelocity)
Compute the current velocity based on the points that have been collected.
的表示是,一毫秒时间单位内运动了多少个像素, unitis值为表示一秒(1000毫秒)时间单位内运动了多少个像素
floatVelocity表示速率的最大值
|
||||||||||
| void |
computeCurrentVelocity(int units)
Equivalent to invoking
computeCurrentVelocity(int, with a maximum velocity of Float.MAX_VALUE. |
||||||||||
| abstract T | getNextPoolable() | ||||||||||
| float |
getXVelocity()
Retrieve the last computed X velocity.
|
||||||||||
| float |
getXVelocity(int id)
Retrieve the last computed X velocity.
|
||||||||||
| float |
getYVelocity(int id)
Retrieve the last computed Y velocity.
|
||||||||||
| float |
getYVelocity()
Retrieve the last computed Y velocity.
|
||||||||||
| abstract boolean | isPooled() | ||||||||||
| static VelocityTracker |
obtain()
Retrieve a new VelocityTracker object to watch the velocity of a motion.
|
||||||||||
| void |
recycle()
Return a VelocityTracker object back to be re-used by others.
|
||||||||||
| abstract void | setNextPoolable(T element) | ||||||||||
| abstract void | setPooled(boolean isPooled) | ||||||||||
()函数来获得当前的速度
VelocityTracker简要的更多相关文章
- JavaScript权威设计--JavaScript函数(简要学习笔记十一)
1.函数调用的四种方式 第三种:构造函数调用 如果构造函数调用在圆括号内包含一组实参列表,先计算这些实参表达式,然后传入函数内.这和函数调用和方法调用是一致的.但如果构造函数没有形参,JavaScri ...
- JavaScript权威设计--JavaScript函数(简要学习笔记十)
1.函数命名规范 函数命名通常以动词为前缀的词组.通常第一个字符小写.当包含多个单词时,一种约定是将单词以下划线分割,就像"like_Zqz()". 还有一种就是"lik ...
- [译]Angular2 和TypeScript -- 一次简要的预览
原文链接:https://www.infoq.com/articles/Angular2-TypeScript-High-Level-Overview 作者: Yakov Fain Posted o ...
- 内网劫持渗透新姿势:MITMf简要指南
声明:本文具有一定攻击性,仅作为技术交流和安全教学之用,不要用在除了搭建环境之外的环境. 0×01 题记 又是一年十月一,想到小伙伴们都纷纷出门旅游,皆有美酒佳人相伴,想到这里,不禁潸然泪下.子曰:& ...
- android VelocityTracker 速度追踪器的使用及创建
VelocityTracker 速度追踪 第一,创建方式: VelocityTracker mVelocityTracker = new VelocityTracker .obtain() 第二, ...
- markdown简要说明显示样式
markdown 什么是markdown: Markdown是一种可以使用普通文本编辑器编写的标记语言,通过简单的标记语法,它可以使普通文本内容具有一定的格式. Markdown具有一系列 ...
- 使用VelocityTracker来完成MotionEvent移动速率计算
先看效果图 关键代码(此处记录单点): switch (event.getAction()){ case MotionEvent.ACTION_DOWN: if (veloctiy==null) { ...
- 简要介绍BASE64、MD5、SHA、HMAC几种方法。
加密解密,曾经是我一个毕业设计的重要组件.在工作了多年以后回想当时那个加密.解密算法,实在是太单纯了. 言归正传,这里我们主要描述Java已经实现的一些加密解密算法,最后介绍数字证书. ...
- Java Reference简要概述
@(Java)[Reference] Java Reference简要概述 Reference对象封装了其它对象的引用,可以和普通的对象一样操作. Java提供了四种不同类型的引用,引用级别从高到低分 ...
随机推荐
- [TypeStyle] Use fallback values in TypeStyle for better browser support
You can increase the browser support of your CSS using fallback values and vendor prefixes. This les ...
- [TypeStyle] Load raw CSS in TypeStyle
TypeStyle tries to be an all in one CSS in JS management solution so you can always fall back to raw ...
- ViewChild与ContentChild的联系和区别
原文 https://www.jianshu.com/p/5ab619e576ea 大纲 1.认识ViewChild 2.认识ContentChild 3.ViewChild与ContentChild ...
- [Angular] Using useExisting provider
Unlike 'useClass', 'useExisting' doesn't create a new instance when you register your service inside ...
- ASP.NET 的 ViewState Cookie Session 等的比較
类型 值保存在哪 值的有效范围 备注 View State client 不能跨页面传递.仅仅能在当前页面保存数据. 在HTML中能够看到ViewState值,只是是加密. 不是明文. ViewSta ...
- mysql zip文件安装
bin目录下执行mysqld -install再执行mysqld --initialize-insecure 启动服务:net start mysql
- 【u005】封锁阳光大学
Time Limit: 1 second Memory Limit: 128 MB [问题描述] 曹是一只爱刷街的老曹,暑假期间,他每天都欢快地在阳光大学的校园里刷街.河蟹看到欢快的曹,感到不爽.河蟹 ...
- mybatis结合log4j打印SQL日志
mybatis结合log4j打印SQL日志 1.Maven引用jar包 默认的mybatis不能打印出SQL日志,不便于查看调试,须要结合log4jdbc-log4j2就能够完整的输入SQL的调试信息 ...
- 谷歌AI中国中心成立,人工智能势不可挡?
昨日,谷歌在上海举办了一年一度的Google中国开发者大会.在本届大会上,谷歌云首席科学家李飞飞宣布了一个重磅消息,即在北京将成立谷歌AI中国中心.对于这个即将成立的AI中心谷歌寄予厚望,希望与中国本 ...
- java常用api2
calendar calendar=calendar.getInstance(); StringBuilder和C#的用法一样 hashSet无序的,不可重复 LInkedHashSet有序的,不可重 ...