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

如何移除Cordova应用程序中的启动屏

Cordova 12.0.0 移除启动屏的有效方案

1. 检查并移除启动屏插件

Cordova的启动屏功能基本由cordova-plugin-splashscreen插件提供,先确认插件是否存在:

cordova plugin list

如果列表里有该插件,直接移除:

cordova plugin remove cordova-plugin-splashscreen

2. 清理config.xml中的启动屏配置

打开项目根目录的config.xml,删除或注释掉所有和启动屏相关的配置项,比如:

  • <preference name="SplashScreen" value="..." />
  • <preference name="SplashScreenDelay" value="..." />
  • 所有<splash>标签(定义各尺寸启动图的节点)

3. 修正Android平台默认启动背景(针对Android端)

Cordova 12的Android项目资源路径是platforms/android/app/src/main/res,而非根目录的res。如果移除插件后仍有启动屏,修改主题配置:

  1. 打开res/values/styles.xml
  2. 找到AppTheme节点,将android:windowBackground改为透明:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowBackground">@android:color/transparent</item>
</style>
  1. 检查AndroidManifest.xml中主Activity的android:theme属性,确保引用的是修改后的AppTheme

4. 修正iOS平台启动屏(针对iOS端)

  1. 打开platforms/ios/[你的项目名]/Resources/splash,删除所有启动图片文件
  2. 回到config.xml,确保已移除所有<splash>标签
  3. 重新构建iOS项目

最后验证

执行以下命令清理并重新构建项目:

cordova clean
cordova build [android/ios]

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.20 04:24:56