Android手势检测问题
我有一个 main.xml 作为 ViewFlipper,它为我的程序导入 5 个视图。如果我将整个 main.xml 包装在 GestureoverlayView 中,我可以用侦听器很好地检测手势,但是,它会在屏幕上显示手势。
我不希望显示手势,我只是希望检测到它们,所以我尝试将触摸监听器应用到 ViewFlipper,但它根本没有检测到手势。
这是因为 ViewFlipper 隐藏在显示的 5 个导入布局后面吗?
如何将手势检测应用到我的应用程序而不让 OverlayView 在屏幕上显示手势?
谢谢
I have a my main.xml as a ViewFlipper which imports 5 views for my program. If I wrap the whole main.xml in GestureoverlayView I can detect gestures just fine with my listener, however, it displays the gesture on the screen.
I don't want the gestures shown i just want them detected so I tried applying the touch listener to the ViewFlipper but it simply doens't detect the gestures.
Is this because the ViewFlipper is hidden behind the 5 imported layouts that are displayed?
how do I apply the gesture detection to my app without having the OverlayView show the gestures on the screen?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了一个解决方案,我没有将手势检测严格应用于任何布局,而是以编程方式将其应用于活动。
手势检测器gestureListener = new GestureDetector(this);
一旦它给出错误,只需告诉它实现未实现的方法,然后根据需要在其中编码。
I found a solution where I'm not applying the gesture detection strictly to any of the layouts, but programmatically applying it to the activity.
GestureDetector gestureListener = new GestureDetector(this);
Once it gives an error simply tell it to implement the unimplemented methods and then code inside them as necessary.