android 如何去掉状态栏和标题栏
1个回答
展开全部
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//去除title
requestWindowFeature(Window.FEATURE_NO_TITLE);
//去掉Activity上面的状态栏
getWindow().setFlags(WindowManager.LayoutParams. FLAG_FULLSCREEN , WindowManager.LayoutParams. FLAG_FULLSCREEN);
setContentView(R.layout.main);
}
其中起主要作用的两个语句:
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
//隐去电池等图标和一切修饰部分(状态栏部分)
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
//隐去标题栏(程序的名字)
super.onCreate(savedInstanceState);
//去除title
requestWindowFeature(Window.FEATURE_NO_TITLE);
//去掉Activity上面的状态栏
getWindow().setFlags(WindowManager.LayoutParams. FLAG_FULLSCREEN , WindowManager.LayoutParams. FLAG_FULLSCREEN);
setContentView(R.layout.main);
}
其中起主要作用的两个语句:
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
//隐去电池等图标和一切修饰部分(状态栏部分)
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
//隐去标题栏(程序的名字)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询