我有一个应用程序,可以在特定条件下在全屏和普通屏幕之间切换。我已经成功地完成了通知,但在我将标题栏从全屏设置回正常屏幕模式后,标题栏仍然隐藏。那么隐藏标题栏后如何显示标题栏呢?
编辑:
我遇到的答案是,他们制作了一个自定义标题栏,并在其可见性之间切换,但这不是我想要的。
代码:
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);
}发布于 2012-07-06 12:32:09
尝尝这个
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
/// custom tittle bar declaration
final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
/// custom tittle bar creation ///....
if (customTitleSupported) {
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.tittle_bar);
}
final TextView myTitleText = (TextView) findViewById(R.id.title_bar);
if (myTitleText != null) {
myTitleText.setText("Categories");
}https://stackoverflow.com/questions/11355748
复制相似问题