gpt4 book ai didi

android - WindowManager 中的全屏

转载 作者:IT老高 更新时间:2023-10-28 23:31:27 25 4
gpt4 key购买 nike

这是我的代码:

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);
}

View 仍然显示状态栏,mTopView 是一个覆盖窗口。如何让覆盖窗口覆盖整个屏幕?我不想“隐藏”状态栏,我希望我的 Activity 覆盖在它上面。

[编辑] 强调文字我的 onCreate() 方法中已经有了这个:

requestWindowFeature(Window.FEATURE_NO_TITLE); 
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

我的 list 定义了一种全屏风格。

屏幕截图

enter image description here

目前是这样的,我希望覆盖也扩展到状态栏。

最佳答案

我只需要这样做

params.flags=WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN|其余的

这会在状态栏上扩展覆盖 View 。

关于android - WindowManager 中的全屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14397969/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com