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

Android 12启动页Splash Screen图标背景色不生效问题

解决Splash Screen API图标背景色不生效问题

可能的原因及修复步骤

1. 检查图标资源类型

windowSplashScreenIconBackgroundColor 仅对自适应图标(Adaptive Icon)的前景层生效。如果你使用的 @drawable/ic_launcher_foreground 是普通PNG/SVG而非自适应图标的前景资源,系统不会为其添加圆形背景。

修复方案:

  • 在res/mipmap-anydpi-v26目录下创建自适应图标配置文件ic_launcher.xml:
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@color/orange" />
    <foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
  • 修改启动主题中的图标引用为自适应图标:
<item name="windowSplashScreenAnimatedIcon">@mipmap/ic_launcher</item>

2. 验证API版本兼容性

windowSplashScreenIconBackgroundColor 是Android 12(API 31)及以上版本才支持的属性,运行在低于API 31的设备上时该属性不会生效。

修复方案:

  • 确保应用build.gradle中minSdkVersion设置为31及以上,或针对低版本设备单独实现启动页逻辑。

3. 检查图标自身背景

如果ic_launcher_foreground本身带有不透明背景,会覆盖系统添加的圆形背景色。

修复方案:

  • 使用图片编辑工具移除ic_launcher_foreground的背景,确保图标主体周围为透明区域。

4. 确认主题未被覆盖

虽然已将启动主题应用到<application>标签,但如果某个Activity单独设置了android:theme属性,可能会覆盖启动主题的配置。

修复方案:

  • 检查所有Activity的Manifest配置,确保没有单独设置主题覆盖启动主题的相关属性。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.02 01:25:14