我目前使用
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);
};