特定视图的手势检测
Gesture Detection for Specific View
添加了一个没有覆盖所有布局的 spaceView。我希望手势检测仅适用于该视图。
不能做太多,但这是我的代码:
space = findViewById(R.id.space);
this.gDetector = new GestureDetectorCompat(this, this);
gDetector.setOnDoubleTapListener(this);
Android 中的 onTouchEvent
让您可以这样做。您可以在该活动中添加任何您想做的事情。
根据 Android Studio 的官方网站,onTouchEvent()
被描述为 ...
当用户将一根或多根手指放在屏幕上时,会触发接收到触摸事件的View的回调onTouchEvent()。对于最终被识别为手势的每个触摸事件序列(位置、压力、大小、添加另一个手指等),都会触发多次 onTouchEvent()。
Here's官方link向您求助
希望这对您有所帮助...
添加了一个没有覆盖所有布局的 spaceView。我希望手势检测仅适用于该视图。
不能做太多,但这是我的代码:
space = findViewById(R.id.space);
this.gDetector = new GestureDetectorCompat(this, this);
gDetector.setOnDoubleTapListener(this);
Android 中的 onTouchEvent
让您可以这样做。您可以在该活动中添加任何您想做的事情。
根据 Android Studio 的官方网站,onTouchEvent()
被描述为 ...
当用户将一根或多根手指放在屏幕上时,会触发接收到触摸事件的View的回调onTouchEvent()。对于最终被识别为手势的每个触摸事件序列(位置、压力、大小、添加另一个手指等),都会触发多次 onTouchEvent()。
Here's官方link向您求助
希望这对您有所帮助...