You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android应用Splash Screen在Deep Link及AS启动时失效问题

问题描述

从启动器启动应用时,Splash Screen可正常工作;但通过Deep Link启动时,Logo动画未触发,且关联的SplashScreen.OnExitAnimationListener代码未执行。该问题同样出现在Android 12真机通过Android Studio启动应用时。

相关配置代码

Manifest.xml

<activity
    android:name=".main.MainActivity"
    android:configChanges="orientation|screenSize"
    android:theme="@style/SplashScreenTheme"
    android:exported="true"
    android:screenOrientation="portrait"
>
    <intent-filter>
        <data
            android:host="prateekgupta.pythonanywhere.com"
            android:scheme="https" />

        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />

        <action android:name="android.intent.action.VIEW" />
    </intent-filter>
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

theme.xml

<style name="SplashScreenTheme" parent="Theme.SplashScreen">
    <item name="windowSplashScreenBackground">@color/logo_bg</item>
    <item name="windowSplashScreenAnimatedIcon">@drawable/splash_screen_logo_animation</item>
    <item name="windowSplashScreenAnimationDuration">2000</item>
    <item name="postSplashScreenTheme">@style/MainTheme</item>
</style>

MainActivity

SplashScreen splashScreen = SplashScreen.installSplashScreen(this);

splashScreen.setOnExitAnimationListener(splashScreenViewProvider -> {
    TranslateAnimation translateAnimation = new TranslateAnimation(
            Animation.RELATIVE_TO_PARENT, 0f,
            Animation.RELATIVE_TO_PARENT, -1f,
            Animation.RELATIVE_TO_PARENT, 0,
            Animation.RELATIVE_TO_PARENT, 0f);
    translateAnimation.setDuration(1000L);
    translateAnimation.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {

        }

        @Override
        public void onAnimationEnd(Animation animation) {
            splashScreenViewProvider.remove();
        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    });

    // Starting exit animation of SplashScreen
    splashScreenViewProvider.getView().startAnimation(translateAnimation);
});

请问是否遗漏了某些配置?


内容的提问来源于stack exchange,提问作者Prateek Gupta

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.16 11:27:37