[英]WindowManager - drawing on top of the navigation bar (buttons) Android
Good afternoon. 下午好。 I have a service in which the object is created and WindowManager View - is assigned parameter background (mView.setBackgroundColor(color). The fact is that now I have View drawn only over the main desktop screen and status bar, and navigation bar is not affected. How do I do to View draws and on top of the navigation bar (buttons) in the Android? At the moment:
我有一个在其中创建对象并为WindowManager View分配参数背景(mView.setBackgroundColor(color)的服务。事实是,现在我仅在主桌面屏幕和状态栏上绘制了View,而导航栏却没有我该如何在Android的导航栏(按钮)顶部查看绘图?
@Override
public void onCreate() {
super.onCreate();
mView = new LinearLayout(this);
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
0 | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
PixelFormat.TRANSLUCENT);
WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
wm.addView(mView, params);
}
Result: enter image description here 结果: 在此处输入图像描述
That is all I have to paint in red, relatively speaking, including a navigation bar. 相对而言,这就是我要用红色绘制的所有内容,包括导航栏。 Thank you.
谢谢。
int value_below_screen=100;
params.y=-value_below_screen;
this will offset the screen below by "value_below_screen" 这将使下面的屏幕偏移“ value_below_screen”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.