我正在寻找一种方法来显示和隐藏状态栏onClickListener,但只显示它有效.
WindowManager.LayoutParams lp = getWindow().getAttributes();
if (isStatusbarVisible)
lp.flags = LayoutParams.FLAG_FULLSCREEN;
else
lp.flags = LayoutParams.FLAG_FORCE_NOT_FULLSCREEN;
getWindow().setAttributes(lp);
isStatusbarVisible = !isStatusbarVisible;
Run Code Online (Sandbox Code Playgroud)
隐藏状态栏FLAG_FULLSCREEN似乎只有在调用之前设置了标志时才有效setContentView().
还有另一种隐藏状态栏的方法吗?