【发布时间】:2021-12-21 22:58:00
【问题描述】:
我正在尝试用新的 Splashscreens API 替换我的 Android 应用中基于活动的旧启动画面
所以我创建了我的应用程序徽标的 svg,创建了主题,并在我的 MainActivity 中设置了 installSplashScreen,但启动应用程序时启动画面中的徽标看起来像这样:
我该如何解决这个问题?
这是我所做的 style.xml:
<style name="Theme.App.Starting" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/colorAccent</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_visual_vector</item>
<item name="postSplashScreenTheme">@style/AppTheme</item>
</style>
清单:
<activity
android:name=".MainActivity"
android:theme="@style/Theme.App.Starting"
android:screenOrientation="portrait"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
主活动:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SplashScreen.installSplashScreen(this);
setContentView(R.layout.activity_main);
...
【问题讨论】:
标签: android splash-screen