1.super.onCreate(savedInstanceState)方法之前调用:
setTheme(android.R.style.Theme_Light_NoTitleBar_Fullscreen);
2.setContentView(R.layout.xxx)之前调用:
requestWindowFeature(Window.FEATURE_NO_TITLE); // 去除标题
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); // 去除状态栏
3.清单文件中配置:
android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
该两个属性可以再application中设置也可以再activity中设置,在application节点中设置该程序所有的activity都会是全屏显示
在activity中设置只有该activity是全屏显示的
时间: 2024-10-28 22:45:12