检测是否触摸Android设备屏幕上停止 [英] detect if the touch stopped on an android device screen

查看:302
本文介绍了检测是否触摸Android设备屏幕上停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要触摸已经启动,离开屏幕后火的方法。我可以通过一个OnTouch事件设置为查看检测触摸的开始,但是当手离开屏幕无法察觉。我想请问触摸停止时被发现。我如何检测呢?

I want to fire a method after a touch has been initiated and left the screen. I can detect the beginning of a touch by setting a OnTouch event to the View but can't detect when the hand leave the screen. I want to detect when does the touch stops. How can i detect this?

推荐答案

什么你要找的是的 http://developer.android.com/reference/android/view/MotionEvent.html - 特别是使用 MotionEvent.ACTION_UP 。还有就是我所提供的链接,很多信息:)

What you're looking for is http://developer.android.com/reference/android/view/MotionEvent.html - Specifically the use of MotionEvent.ACTION_UP. There is a lot of information on the link I've provided :)

一个手势开始与ACTION_DOWN一个运动事件,提供了第一指针的位置向下。作为这一下降或达每增加一个指针,该框架将生成ACTION_POINTER_DOWN或ACTION_POINTER_UP相应的运动盛会。指针移动通过与ACTION_MOVE移动事件描述。最后,一​​个手势或者结束时的最后指针上升通过与ACTION_UP或运动事件psented重新$ P $当手势取消了ACTION_CANCEL。

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设备屏幕上停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆