- 方式一:AndroidManifest.xml 设置 style 属性
// 全屏
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
// 无标题栏
android:theme="@android:style/Theme.NoTitleBar"
或者
<style name="BaseAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
</style>
- 方式二:代码设置
// 全屏
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
// 无标题栏
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);