系统覆盖的Andr​​oid 4.0 [英] System overlay android 4.0

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

问题描述

在Android 4.0的,你可以创建和覆盖在任何应用程序与TYPE_SYSTEM_OVERLAY并获得接触与FLAG_WATCH_OUTSIDE_TOUCH ......现在用的Andr​​oid 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.

基本理念遵循这个程序, <一href="http://www.appbrain.com/app/smart-taskbar-%28sidebar%29/com.smart.taskbar">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.

香港专业教育学院望着每一个地方的在An​​droid 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?

推荐答案

我发现这里完整的示例应用程序,适用于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.

相反,将其设置为<一个href="http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#TYPE_PHONE">TYPE_PHONE.

Instead set it to TYPE_PHONE.

使用以下标志:

<一个href="http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_NOT_TOUCH_MODAL">FLAG_NOT_TOUCH_MODAL

<一个href="http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_WATCH_OUTSIDE_TOUCH">FLAG_WATCH_OUTSIDE_TOUCH

<一个href="http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_NOT_TOUCH_MODAL">FLAG_NOT_TOUCH_MODAL &LT;&LT;这个是非常重要的。没有它,焦点是考虑到叠加和软键(家庭,菜单,   等等)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.

另外,还要确保你添加的<一个href="http://developer.android.com/reference/android/Manifest.permission.html#SYSTEM_ALERT_WINDOW">SYSTEM_ALERT_WINDOW许可权   的mainifest文件。

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

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

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