这是我的代码:
params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
PixelFormat.TRANSLUCENT);
wm = (WindowManager) getApplicationContext()
.getSystemService(Context.WINDOW_SERVICE);
inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mTopView = (ViewGroup) inflater.inflate(R.layout.activity_invisible, null);
params.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
| WindowManager.LayoutParams.FLAG_DIM_BEHIND
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_FULLSCREEN;
if (keep==true) {
int value = brightnessIntent.getExtras().getInt("value");
float v=value/255.0f;
params.dimAmount=0;
params.alpha=v;
rl = (RelativeLayout) mTopView.findViewById(R.id.window);
getWindow().setAttributes(params);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
wm.addView(mTopView, params);
}
视图仍然显示状态栏,mTopView
是一个覆盖窗口。如何让覆盖窗口覆盖整个屏幕?我不想“隐藏”状态栏,我希望我的活动覆盖在它上面。
[编辑] 强调文本
我已经在我的onCreate()
方法中有这个:
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
我的清单定义了一种全屏风格。
截图
这就是目前的情况,我希望覆盖也扩展到状态栏。