安卓滑动速度

标签 android gesture swipe

计算滑动速度的最佳方法是什么?是否有一些奇特的类或功能提供此功能,或者我是否需要通过测量触碰和触碰来执行此操作?我做了一些搜索,但一无所获——也许我没有正确的术语。

最佳答案

OnGestureListener具有以下方法,提供 x 轴和 y 轴的速度:

public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)

您可以实现 OnGestureListener,或者从文档中:

If you want to listen for all the different gestures then implement this interface. If you only want to listen for a subset it might be easier to extend GestureDetector.SimpleOnGestureListener.

关于安卓滑动速度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11351624/

相关文章:

android加速度计registerListener

android - Android为图像选择器创建图像的水平 ScrollView

iphone - 使用滑动手势从 TableView 中删除文件,但不从文档目录中删除文件

android - 渲染期间引发异常 : Unable to find the layout for Action Bar

java - 我需要帮助暂停和恢复游戏

android - 如何忽略三星 Galaxy 3 上的手掌滑动事件

iphone - 滑动手势有帮助吗?仅 LeftSwipe 有效,而 RightSwipe 无效

jquery - TouchSwipe返回距离X

unity-game-engine - 我们如何为 linerenderer 设置白色

java - 将 JSON 对象数组反序列化为 Java 中的根对象?