android - 检测触摸是否在安卓设备屏幕上停止

标签 android motion-detection motionevent

我想在启动触摸并离开屏幕后触发一个方法。我可以通过将 OnTouch 事件设置为 View 来检测触摸的开始,但无法检测手何时离开屏幕。我想检测触摸何时停止。我怎样才能检测到这一点?

最佳答案

您要找的是http://developer.android.com/reference/android/view/MotionEvent.html - 特别是 MotionEvent.ACTION_UP 的使用。我提供的链接上有很多信息:)

A gesture starts with a motion event with ACTION_DOWN that provides the location of the first pointer down. As each additional pointer that goes down or up, the framework will generate a motion event with ACTION_POINTER_DOWN or ACTION_POINTER_UP accordingly. Pointer movements are described by motion events with ACTION_MOVE. Finally, a gesture end either when the final pointer goes up as represented by a motion event with ACTION_UP or when gesture is canceled with ACTION_CANCEL.

关于android - 检测触摸是否在安卓设备屏幕上停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20639807/

相关文章:

android - IAB 助手未设置。无法执行操作(Android 2.3.3)

c# - MvvmCross 3.0.14 - MvxListView 选择在 Android 中不起作用

opencv - 对于没有 GPU 的系统,是否可以使用在 opencv 中实现的 ViBe 算法?

ios - 我如何检测有人在摇动 iPhone?

artificial-intelligence - 人工神经网络的运动识别

Android 向 imageview 显示 facebook 头像

android - android构建后无法运行模拟器

java - 检测悬停/滑动按钮

java - Android MotionEvent.Action_MOVE

java - ListView onTouch 运动事件