如何显示全屏窗口TYPE_SYSTEM_ALERT? [英] How to display a fullscreen TYPE_SYSTEM_ALERT window?
问题描述
我目前有一个困难时期显示在全屏模式下的TYPE_SYSTEM_ALERT窗口。我想,才能有重叠角度,从服务创建这样做,在状态栏的顶部,但没有隐藏它。
I'm currently having a hard time displaying a TYPE_SYSTEM_ALERT window in fullscreen mode. I'd like to do so in order to have an overlay view, created from a service, on top of the status bar but without hiding it.
不过,把FLAG_FULLSCREEN国旗在我创建了窗口的布局PARAMS似乎并没有工作。我发现STATUS_BAR和EXPAND_STATUS_BAR权限,但我找不到如何使用它们。
However, putting the FLAG_FULLSCREEN flag in the layout params of the window I'm creating doesn't seem to work. I found the STATUS_BAR and EXPAND_STATUS_BAR permissions but I couldn't find how to make use of them.
下面是的LayoutParams:
Here are the LayoutParams :
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
WindowManager.LayoutParams.FLAG_FULLSCREEN,
PixelFormat.TRANSLUCENT);
params.gravity = Gravity.RIGHT | Gravity.TOP;
mWindowManager.addView(mOverlayView, params);
任何想法?
感谢您
推荐答案
我找到了解决办法,同时试图做别的事情!
I found the solution while trying to do something else!
为了让每一个其他窗口的顶部,并在状态栏必须添加FLAG_LAYOUT_IN_SCREEN标志,而不是FLAG_LAYOUT_FULLSCREEN标志的顶部TYPE_SYSTEM_ALERT窗口:
In order to have a TYPE_SYSTEM_ALERT window on top of every other window AND on top of the status bar you must add the FLAG_LAYOUT_IN_SCREEN flag and not the FLAG_LAYOUT_FULLSCREEN flag :
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
PixelFormat.TRANSLUCENT);
mWindowManager.addView(mOverlayView, params);
这篇关于如何显示全屏窗口TYPE_SYSTEM_ALERT?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!