android - Android 中的全局触摸手势?

标签 android xamarin xamarin.android gesture gestures

所以我开始创建一个非常简单的应用程序,并阅读了如何在应用程序中设置手势。
我想知道是否有办法为android设备设置全局手势?

如果应用程序在后台运行(根本不在屏幕上)并且用户在屏幕上执行一些手势。我可以控制吗?我可以根据该手势启动某些内容或激活某些内容吗?

如果可以的话,请给我一些详细信息。我对此有点陌生。

谢谢。

最佳答案

全局接收触摸手势的唯一方法是使用 AccessibilityServiceFLAG_REQUEST_TOUCH_EXPLORATION_MODE标志已启用。当这样的 AccessibilityService 处于 Activity 状态时,将进入“触摸探索模式”。结果是(引自上面的链接)

In this mode a single finger moving on the screen behaves as a mouse pointer hovering over the user interface. The system will also detect certain gestures performed on the touch screen and notify this service.

系统检测到的手势列在 AccessibilityService documentation 中。请考虑这对系统的总体使用有很大影响。 此外,用户必须通过辅助功能系统设置手动启用 AccessibilityService

关于android - Android 中的全局触摸手势?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27312790/

相关文章:

android - 如何在Android应用程序中上传从相机拍摄的图像

c# - MonoMac/Xamarin.Mac : EntryPointNotFoundException for AudioSession. 初始化()

android - Xamarin.Form 元素中的 Material 主题

xamarin.android - 在 Xamarin Forms 中启动 Android 事件?

iphone - 使用触摸屏进行游戏控制

android - UnsatisfiedLinkError : Couldn't load libopencv_java. 所以

android - 获取当前位置城市名称,android

java - RecyclerView throw 和项目点击

c# - .NET 可移植类库中的 USB 访问

xamarin.android - 如何减少 Xamarin Forms 中按钮之间的间距