全屏显示有两种方法
0:
如果想在这个项目里 所有Activity 都全屏 ,只需要 在manifest文件中 Application 添加一个主题样式
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"//去掉状态栏及标题栏
1:
在setContentView(R.layout.**)前面加入:
this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);//去掉信息栏
2 :
//显示全屏
private void setFullScreen()
{
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
//[代码] 退出全屏函数:
private void quitFullScreen()
{
final WindowManager.LayoutParams attrs = getWindow().getAttributes();
attrs.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().setAttributes(attrs);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}