Android手势检测问题

发布于 2024-09-26 08:30:33 字数 294 浏览 0 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

溺渁∝ 2024-10-03 08:30:33

我找到了一个解决方案,我没有将手势检测严格应用于任何布局,而是以编程方式将其应用于活动。

手势检测器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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文