已经解决了,谢谢各位。在网上找的代码,现在贴出来共享一下:
主要用到的方法为:
private void full(boolean enable) {
if (enable) {//隐藏状态栏
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
getWindow().setAttributes(lp);
} else {//显示状态栏
WindowManager.LayoutParams attr = getWindow().getAttributes();
attr.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().setAttributes(attr);
}
}