Android Activity设置全屏显示
代码中设置
requestWindowFeature(Window.FEATURE_NO_TITLE); //隐藏标题
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN); //设置全屏
setContentView(R.layout.activity_main);
注意:setContentView一定要写在设置全屏后边
AndroidManifest.xml文件中设置
<application
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:name="com.scwindow.utility.CrashApplication">
在styles.xml文件中定义主题AppTheme
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowIsTranslucent">true</item>
</style>
版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/02/18/android-activity-full-screen/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。
THE END
1
二维码
打赏
海报
Android Activity设置全屏显示
代码中设置
requestWindowFeature(Window.FEATURE_NO_TITLE); //隐藏标题
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowMan……
文章目录
关闭
共有 0 条评论