检测长preSS采用Android [英] Detecting a long press with Android
本文介绍了检测长preSS采用Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前使用
onTouchEvent(MotionEvent event){
}
,以检测当用户presses我glSurfaceView有什么方法来检测时,长按而成。我猜,如果我不能找到太多的开发文档那么这将是某种形式的变通方法。像注册ACTION_DOWN,看到它是ACTION_UP过了多久。
to detect when the user presses my glSurfaceView is there a way to detect when a long click is made. I'm guessing if I can't find much in the dev docs then it will be some sort of work around method. Something like registering ACTION_DOWN and seeing how long it is before ACTION_UP.
如何检测长途presses的Android使用的OpenGL-ES?
How do you detect long presses on android using opengl-es?
推荐答案
试试这个:
final GestureDetector gestureDetector = new GestureDetector(new GestureDetector.SimpleOnGestureListener() {
public void onLongPress(MotionEvent e) {
Log.e("", "Longpress detected");
}
});
public boolean onTouchEvent(MotionEvent event) {
return gestureDetector.onTouchEvent(event);
};
这篇关于检测长preSS采用Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文