系统覆盖android 4.0

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

问题描述

限时送ChatGPT账号..

在 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Sending a keyboard event from java to any application (on-screen-keyboard)(将键盘事件从 java 发送到任何应用程序(屏幕键盘))
How to make JComboBox selected item not changed when scrolling through its popuplist using keyboard(使用键盘滚动其弹出列表时如何使 JComboBox 所选项目不更改)
Capturing keystrokes without focus(在没有焦点的情况下捕获击键)
How can I position a layout right above the android on-screen keyboard?(如何将布局放置在 android 屏幕键盘的正上方?)
How to check for key being held down on startup in Java(如何检查在Java中启动时按住的键)
Android - Get keyboard key press(Android - 获取键盘按键)