我有一个应用程序可以在特定条件下在全屏和普通屏幕之间切换。我已通过通知成功完成此操作,但在将其从全屏模式设置回正常屏幕模式后,标题栏仍保持隐藏状态。那么隐藏后如何显示标题栏?
编辑:
我遇到了他们制作自定义标题栏并在其可见性之间切换的答案,但这不是我想要的。
代码:
if(ScreenReceiver.wasScreenOn) {
Toast toast=Toast.makeText(this, "screen was on", Toast.LENGTH_LONG);
toast.show();
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
setContentView(R.layout.resume);
} else {
Toast toast=Toast.makeText(this, "screen was off", Toast.LENGTH_LONG);
toast.show();
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
setContentView(R.layout.main);
}