问题描述
在Android 4.0的,你可以创建和覆盖在任何应用程序与TYPE_SYSTEM_OVERLAY并获得接触与FLAG_WATCH_OUTSIDE_TOUCH ......现在用的Android 4.0,你不能接受的一面。
Before android 4.0 you could create and overlay over any app with TYPE_SYSTEM_OVERLAY and get touches with FLAG_WATCH_OUTSIDE_TOUCH... Now with android 4 you cant receive the touches.
基本理念遵循这个程序,http://www.appbrain.com/app/smart-taskbar-%28sidebar%29/com.smart.taskbar你可以让你的应用程序打开,或者总在最前面。它可以运行在任何应用程序。
basically the idea follows this app,http://www.appbrain.com/app/smart-taskbar-%28sidebar%29/com.smart.taskbarYou can keep your app open, or always on top. it will run over any app.
香港专业教育学院望着每一个地方的在Android 4.0中使用,但没有运气的信息,甚至来源$ C $ C ...现在...我知道肯定有应用程序,仍然做到这一点甚至在4.0 ... ...有还是一种方式。任何想法?
Ive looked every where for information and even source code for the use on android 4.0 but no luck... Now.. I know for certain there are apps that still do this even on 4.0... there is still a way. Any ideas?
推荐答案
下面是重头戏:
要创建一个覆盖视图,设置时的LayoutParams的不要 设置为TYPE_SYSTEM_OVERLAY类型。
相反,将其设置为TYPE_PHONE.
Instead set it to TYPE_PHONE.
使用以下标志:
FLAG_NOT_TOUCH_MODAL
FLAG_WATCH_OUTSIDE_TOUCH
FLAG_NOT_TOUCH_MODAL <<这个是非常重要的。没有它,焦点是考虑到叠加和软键(家庭,菜单, 等等)presses不会传递到下面的活动。
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.
另外,还要确保你添加的SYSTEM_ALERT_WINDOW许可权 的mainifest文件。
Also make sure you add the SYSTEM_ALERT_WINDOW permission to the mainifest file.
这篇关于系统覆盖的Android 4.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!