技术

关于隐藏Android应用的状态栏,并全屏显示WebView

1.自定义主题NoTitle_FullScreen,在style.xml文件中添加配置

 

<style name="AppTheme.NoTitle_FullScreen"> <!--自定义主题名称-->
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>

 

2.在清单文件中引用该主题,相关代码为:

 

android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:theme="@style/AppTheme.NoTitle_FullScreen"

 

3.修改style.xml中AppTheme的parent键的值为Theme.AppCompat.Light.NoActionBar,完整代码为:

 

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

 

保存并运行,你会发现此时应用的状态栏被隐藏了。

我们都在黑暗中寻找光明。

留言

您的电子邮箱地址不会被公开。 必填项已用*标注