解决方法
您可以尝试以下..实际上我测试了这个并且它工作得很好:
1)扩展GestureDetector.SimpleOnGestureListener并覆盖它的onDoubleTap()方法:
class DoubleTapGestureDetector extends GestureDetector.SimpleOnGestureListener { @Override public boolean onDoubleTap(MotionEvent e) { Log.d("TAG","Double Tap Detected ..."); return true; } }
2)实例化GestureDetector:
final GestureDetector mGesDetect = new GestureDetector(this,new DoubleTapGestureDetector());
3)在SurfaceView上设置OnTouchListener,覆盖其onTouch()方法并调用GestureDetector对象上的onTouchEvent():
surfview.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v,MotionEvent event) { mGesDetect.onTouchEvent(event); return true; } });