在 android 4.0 之前,您可以使用 TYPE_SYSTEM_OVERLAY 创建和覆盖任何应用程序,并使用 FLAG_WATCH_OUTSIDE_TOUCH 进行触摸...现在使用 android 4,您无法接收触摸。
基本上这个想法遵循这个应用程序, http://www.appbrain.com/app/smart-taskbar-%28sidebar%29/com.smart.taskbar 您可以让您的应用程序保持打开状态,或始终位于顶部。它会运行在任何应用程序上。
我到处寻找信息,甚至是在 android 4.0 上使用的源代码,但没有运气......现在..我确信即使在 4.0 上仍然有一些应用程序......还有一种方法.有什么想法吗?
最佳答案
我找到了 a full sample app here that works for Android 4.0
这里是亮点:
To create an overlay view, when setting up the LayoutParams DON'T set the type to TYPE_SYSTEM_OVERLAY.
Instead set it to TYPE_PHONE.
Use the following flags:
FLAG_NOT_TOUCH_MODAL << This one is quite important. Without it, focus is given to the overlay and soft-key (home, menu, etc.) presses are not passed to the activity below.
Also make sure you add the SYSTEM_ALERT_WINDOW permission to the mainifest file.
关于java - 系统覆盖android 4.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14695283/