方法一:在java代码中实现
//取消标题
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
//全屏
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
方法二:在AndroidManifest.xml中根据需要在<application/>或<activity/>中使用Android系统定义的Android主题方式进行设置
方法三:先在res/values下创建一个styles.xml文件,在文件中写入如下内容
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="theme_fullScreen">
<!-- 设置无标题 -->
<item name="android:windowNoTitle">true</item>
<!-- 设置全屏 -->
<item name="android:windowFullscreen">true</item>
</style>
</resources>
然后,在AndroidManifest.xml中根据需要在<application/>或<activity/>中使用自定义的Android主题方式进行设置
android:theme="@style/theme_fullScreen"
//取消标题
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
//全屏
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
方法二:在AndroidManifest.xml中根据需要在<application/>或<activity/>中使用Android系统定义的Android主题方式进行设置
方法三:先在res/values下创建一个styles.xml文件,在文件中写入如下内容
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="theme_fullScreen">
<!-- 设置无标题 -->
<item name="android:windowNoTitle">true</item>
<!-- 设置全屏 -->
<item name="android:windowFullscreen">true</item>
</style>
</resources>
然后,在AndroidManifest.xml中根据需要在<application/>或<activity/>中使用自定义的Android主题方式进行设置
android:theme="@style/theme_fullScreen"
本文介绍了三种实现Android应用全屏显示的方法:通过Java代码、在AndroidManifest.xml中配置系统主题及自定义主题的方式去除标题栏并使应用进入全屏模式。
665

被折叠的 条评论
为什么被折叠?



