Android全屏--两种activity的实现方式
16lz
2021-12-04
Java代码设置
requestWindowFeature(Window.FEATURE_NO_TITLE);//这行代码一定要在setContentView之前,不然会闪退Window window = getWindow();window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
主题设置
自带可设置全屏的主题有:
@android:style/Theme.NoTitleBar.Fullscreen@android:style/Theme.Black.NoTitleBar.Fullscreen@android:style/Theme.Holo.NoActionBar.Fullscreen@android:style/Theme.Light.NoTitleBar.Fullscreen@android:style/Theme.Material.NoActionBar.Fullscreen@android:style/Theme.Translucent.NoTitleBar.Fullscreen@android:style/Theme.Wallpaper.NoTitleBar.Fullscreen@android:style/Theme.DeviceDefault.NoActionBar.Fullscreen@android:style/Theme.Holo.Light.NoActionBar.Fullscreen@android:style/Theme.Material.Light.NoActionBar.Fullscreen@android:style/Theme.DeviceDefault.Light.NoActionBar.Fullscreen
AppCompatActivity全屏姿势
Java代码设置
getSupportActionBar().hide();getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
主题设置
小知识点:
- true
可以实现去title,但是android还有一种 - true
,使用后者替代前者不可以起到去title的作用- false
也有这样的形式: - false
但是- true
没有 - true
更多相关文章
- android闹钟
- Android(安卓)Theme的使用
- Android(安卓)访问权限设置
- android背景选择器总结
- Android-设置手机桌面
- android下访问sd卡和网络的权限
- LinearLayout按下(pressed)或获取焦点(focused)时背景设置不同颜
- Android(安卓)TextView在XML中的属性
- 为Activity屏幕的标题添加图标