是否可以有一个透明的 SYSTEM_ALERT_WINDOW 让 TouchEvents 通过?

Is it possible to have a transparent SYSTEM_ALERT_WINDOW that lets TouchEvents go through?

我有一个覆盖视图,我直接附加到 WindowManager,如下所述:How is Facebook Chat Heads implemented?

我希望这个覆盖视图是部分透明的,并允许 touchEvent 通过(以便用户可以与下面的 Android UI 进行交互)。

这有可能吗?我猜这里可能有一些安全考虑,但无法在任何地方确认这一点。

I would like this overlay View to be partially transparent

没关系——这只是您的 View 是什么(例如,背景)的问题。

and allow touchEvent to go through (so that users can interact with the Android UI below).

幸运的是,出于明显的隐私和安全原因,这是不可能的。您所描述的称为窃听攻击。只有一个应用程序获取触摸事件,因此如果您获取触摸事件,您的应用程序将使用它。

实际上,您可以使用名为 standout 的库让您的应用覆盖屏幕。

杰出图书馆:

https://github.com/pingpongboss/StandOut

应该让你开始你的项目!