ILi*_*hon 0 android splash-screen android-studio
我正在使用主题从可绘制对象中制作启动画面。但是,启动屏幕的可绘制对象显示在系统栏后面,如下所示。
这是我的可绘制启动画面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>
Run Code Online (Sandbox Code Playgroud)
这是我的启动屏幕主题:
<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>
Run Code Online (Sandbox Code Playgroud)
然后我将此主题应用到清单中的启动活动中:
<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>
Run Code Online (Sandbox Code Playgroud)
我已经尝试在启动主题中将fitsSystemWindows设置为true,并且我的启动活动没有布局文件来将fitsSystemWindows设置为true。
我怎样才能让我的启动屏幕不会显示在系统栏后面?
找到了解决方案:
在启动主题中,更改
<item name="android:windowBackground">@drawable/splash_screen</item>
Run Code Online (Sandbox Code Playgroud)
到
<item name="android:background">@drawable/splash_screen</item>
Run Code Online (Sandbox Code Playgroud)
现在,启动屏幕可绘制对象不会在系统栏后面绘制