网上很多方法使用以后都造成了项目的闪退,只有这个起了作用,在这里记录一下。
if (getSupportActionBar() != null) {
getSupportActionBar().hide();
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN
);
}
这句代码要写在setContentView(R.layout.activity_main)后面才会生效。
本文参考了简书作者北风2125
原文链接https://www.jianshu.com/p/385cd0f59196