我正在使用一个主题,使一个可绘制的闪屏。但是,启动屏幕的可绘制显示在系统栏后面,如下所示。

这是我的闪屏可绘制splash_screen.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/slighty_red" />
<item>
<bitmap
android:src="@drawable/test_icon"
android:gravity="center_horizontal|bottom" />
</item>
</layer-list>这是我的闪屏主题:
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/splash_screen</item>
<item name="android:fitsSystemWindows">true</item> <!--Tried this but it doesn't work-->
</style>然后,我将这个主题应用于清单中的splash活动:
<activity
android:name=".SplashActivity"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>我已经尝试在splash主题中将fitsSystemWindows设置为true,并且我的splash活动中没有布局文件可以将fitsSystemWindows设置为true。
我怎样才能让我的闪屏不显示在系统栏后面?
发布于 2018-08-15 04:23:28
找到解决方案:
在启动主题中,更改
<item name="android:windowBackground">@drawable/splash_screen</item>至
<item name="android:background">@drawable/splash_screen</item>现在,启动画面将不会绘制在系统栏后面
发布于 2018-08-14 14:27:01
如果您不想花更多时间调试此问题,可以使用android:paddingTop="20dp"进行简单快速的修复
发布于 2018-08-14 14:31:26
这将使你的闪屏进入全屏模式。只需将此添加到您的onCreate()或onCreateView()。
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN);https://stackoverflow.com/questions/51834904
复制相似问题