Android中隐藏标题栏和状态栏
http://www.cnblogs.com/zhuguangwei/archive/2011/01/18/1938276.html
一、隐藏标题栏
//隐藏标题栏
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
二、隐藏状态栏
//隐藏状态栏
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
三、去掉所有Activity界面的标题栏
修改AndroidManifest.xml
在application 标签中添加android:theme="@android:style/Theme.NoTitleBar"
四、去掉所有Activity界面的TitleBar 和StatusBar
修改AndroidManifest.xml
在application 标签中添加
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android动态显示和隐藏status bar(通知栏)
1,在Activity的onCreate中设置:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
2,在需要显示和隐藏的时候调用:
private void hideStatusBar() {
WindowManager.LayoutParams attrs = getWindow().getAttributes();
attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
getWindow().setAttributes(attrs);
}
private void showStatusBar() {
WindowManager.LayoutParams attrs = getWindow().getAttributes();
attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;
getWindow().setAttributes(attrs);
}