系统覆盖android 4.0 [英] System overlay android 4.0

查看:18
本文介绍了系统覆盖android 4.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 android 4.0 之前,您可以使用 TYPE_SYSTEM_OVERLAY 创建和覆盖任何应用程序并使用 FLAG_WATCH_OUTSIDE_TOUCH 进行触摸...现在使用 android 4 您无法接收触摸.

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.taskbar You can keep your app open, or always on top. it will run over any app.

我到处寻找信息甚至源代码以在 android 4.0 上使用,但没有运气...现在..我确定有些应用程序即使在 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?

推荐答案

我在这里找到了一个适用于 Android 4.0 的完整示例应用程序

这里是重点:

要创建覆盖视图,在设置 LayoutParams 时 不要将类型设置为 TYPE_SYSTEM_OVERLAY.

To create an overlay view, when setting up the LayoutParams DON'T set the type to TYPE_SYSTEM_OVERLAY.

而是将其设置为 TYPE_PHONE.

Instead set it to TYPE_PHONE.

使用以下标志:

FLAG_NOT_TOUCH_MODAL

FLAG_WATCH_OUTSIDE_TOUCH

FLAG_NOT_TOUCH_MODAL <<这个相当重要.没有它,焦点将集中在覆盖和软键(主页、菜单、等)新闻不会传递给下面的活动.

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 权限到主文件.

Also make sure you add the SYSTEM_ALERT_WINDOW permission to the mainifest file.

这篇关于系统覆盖android 4.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆