我想在导航栏中设置颜色,但它没有覆盖。甚至我设置了FLAG_LAYOUT_IN_SCREEN。如何在整个屏幕中设置透明布局。 Plz帮帮我? **这是我的代码:**
View mView = new View(this);
mView.setBackgroundColor(shared.getColor());
// get the WindowManager for the context-specific Display
WindowManager wm = (WindowManager) getApplicationContext().getSystemService(WINDOW_SERVICE);
// create the LayoutParams for the new Window
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,//width
WindowManager.LayoutParams.FILL_PARENT,//height
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,//xpos // TYPE_SYSTEM_ALERT is denied in apiLevel >=19
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,// flags
PixelFormat.TRANSLUCENT //formats // the pixel format, here: translucent
);
wm.addView(mView, params);