我有一个简单的启动画面,白色背景和标志位于屏幕中央。在现代版本的Android上,它运行良好,但在“旧”版本的Android(例如API 22)中,我的标志被拉伸到整个屏幕。如何使标志启动画面在所有Android版本(API 19之前)上看起来正常?
drawable/background_splash.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/white" />
<item
android:width="150dp"
android:height="50dp"
android:drawable="@mipmap/my_logo"
android:gravity="center" />
</layer-list>
values/styles.xml
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:statusBarColor">@color/white</item>
</style>
<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@drawable/background_splash</item>
<item name="android:statusBarColor">@color/white</item>
</style>
</resources>