代码改变世界

Android学习之设置全屏

2011-12-23 15:35  硕硕  阅读(166)  评论(0编辑  收藏  举报

编辑器加载中...

第一点是设置隐去通知栏(状态栏部分,包括电池等图标)

第二点是设置隐去标题栏(应用的名字)

 

 1  /** Called when the activity is first created. */  
2 @Override
3 public void onCreate(Bundle savedInstanceState) {
4 super.onCreate(savedInstanceState);
5 this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
6 //隐去通知栏
7 this.requestWindowFeature(Window.FEATURE_NO_TITLE);
8 // 隐去标题栏
9 setContentView(new MyView(this));
10 }

 

 

 

    在AndroidManifest.xml中定义

    android:theme="@android:style/Theme.NoTitleBar" 隐去标题栏   
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 隐去状态栏