在android oreo中,我不能再使用WindowManager.LayoutParams.TYPE_SYSTEM_ERROR
,而必须使用WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY
。缺点是,此模式不会覆盖状态栏。
无论如何都可以实现旧的行为并且能够在状态栏上绘制?我有一个侧边栏应用程序,直到现在,我允许用户在屏幕顶部也有触发区域,现在不再起作用,因为状态栏现在重叠在顶部的可触摸区域...
我对任何解决方案感兴趣,即使它只适用于某些设备,例如root设备......因为我认为这个问题没有正常的解决方案,因为android系统不再允许这样做了文档(https://developer.android.com/about/versions/oreo/android-8.0-changes.html#o-apps)。不过,这并不意味着没有替代解决方案......
答案 0 :(得分:2)
不幸的是,这已不再可能......
利用此功能的开发者已在base
上打开了bug
个举报,以抗议此更改,并要求提供替代Android’s Issue Tracker (#260787 and #36574245)
,但Google员工对API
的评论进行了评论以下声明:
状态:无法修复(预期行为)
我们跟进了产品和工程团队,并得到建议开发人员可以使用SHOW_WHEN_LOCKED活动来展示 当设备被锁定时,但故意不再可能 通过锁定屏幕/通知阴影显示
并且只有解决方案,您将目标tracker
设置为25
答案 1 :(得分:2)
文档说该标志已弃用非系统应用程序。您是否尝试将该应用程序设为系统应用程序?
此常量在API级别26中已弃用非系统应用。
以下是ES文件资源管理器的使用方法:
Configure ES File Explorer by doing the following steps:
Launch ES File Explorer.
Select Menu and choose Settings.
Under Settings, enable the options for Up to root and Root Explorer. A message will appear, requiring you to confirm your action. You will also need to confirm Superuser access.
Enable Mount File System.
Go back to the app’s main menu.
Get a copy of the APK (Android Package) of the app that you want to save as a system file by doing the following steps (skip to step 3 if you already have the app’s APK file):
Install an app from the Google Play Store. For this guide, we will be using the app BioRhythms as an example.
Launch ES File Explorer and navigate to /data/app.
Locate the APK file that you want to install as a system app. If you don’t know the APK’s filename, simply go to the Google Play Store link of your chosen app. View the link and take note of the words after “?id=”. This will be your APK’s filename. For instance, the BioRhythms app link is https://play.google.com/store/apps/details?id=app.biorhythms. The BioRhythms’ APK is app.biorhythms-1.apk.
Create a backup of the chosen APK by copying it to the phone’s SD Card.
After creating a backup, long tap on the APK file and a menu will appear. Choose Cut. A blue arrow will appear at the bottom of the screen.
Go back to the main menu and navigate to /system/app/.
Drag the little arrow at the bottom of the screen. It will bring up the icon of the APK file.
Tap the APK file and it will be transferred to /system/app/.
Find the APK file in /system/app/. Press and hold it and a menu will appear.
Select Properties on the menu. The dialog properties will show up.
Tap Change and it will show the permissions dialog box.
Check the boxes for the following permissions in the dialog box:
User: Read and Write
Group: Read
Other: Read
Select OK once the required settings have been made.
Reboot your device.
答案 2 :(得分:0)
我担心你不能在android oreo中这样做,因为google停止了支持,以便通知直到日期。可能在将来他们可能会考虑实施这一点,因为许多开发人员正在抗议这一点。
有关详细信息,请访问以下链接:
https://www.androidauthority.com/android-o-draw-over-system-763178/
https://www.reddit.com/r/Android/comments/64ffk1/android_o_is_breaking_apps_that_overlay_on_top_of/