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

如何移除Android应用启动闪屏前显示的默认Logo?

Android启动闪屏优化:去除默认Logo直接显示自定义闪屏

那个短暂出现的应用Logo是Android系统的默认启动预览窗口,和资源加载耗时无关。系统在启动应用时,会自动创建一个基于应用主题的临时窗口(包含APP图标),直到你的SplashActivity布局完全加载完成,这个临时窗口才会消失。

解决步骤

1. 创建Splash专属主题

在res/values/styles.xml(若需适配Android 12+,可在res/values-v31/styles.xml补充)中添加专属主题,隐藏系统启动窗口元素:

<style name="Theme.Splash" parent="Theme.MaterialComponents.DayNight.NoActionBar">
    <!-- 禁用系统启动预览窗口,直接跳过默认Logo显示 -->
    <item name="android:windowDisablePreview">true</item>
    <!-- 设置窗口背景与闪屏布局背景一致,避免切换闪烁 -->
    <item name="android:windowBackground">#FCFCFC</item>
    <!-- 可选:隐藏状态栏和导航栏,适配全屏闪屏 -->
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowContentOverlay">@null</item>
</style>

如果你的闪屏背景是图片,可将windowBackground设为对应的drawable资源:

<item name="android:windowBackground">@drawable/splash_background</item>

2. 修改Manifest配置

将SplashActivity的主题替换为刚才创建的Theme.Splash:

<activity
    android:name=".SplashScreen"
    android:exported="true"
    android:screenOrientation="portrait"
    android:theme="@style/Theme.Splash"> <!-- 替换为专属主题 -->
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

3. 优化闪屏逻辑(可选)

保持SplashActivity的代码简洁,避免在onCreate中执行耗时操作,确保布局快速加载。若需兼容Android 12+,可使用官方的SplashScreen API实现更规范的闪屏效果,但上述方法已能满足基础需求。


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.29 17:25:21