我正在使用 Cordova 构建一个应用程序。除了闪屏之外,其他一切都可以正常工作。 最近有人用过吗? 这是我的代码: config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.example.hello" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloWorld</name>
<description>Sample Apache Cordova App</description>
<author email="[email protected]" href="https://cordova.apache.org">
Apache Cordova Team
</author>
<content src="index.html" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<platform name="android">
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<preference name="SplashMaintainAspectRatio" value="true" />
<icon density="ldpi" src="res/icon/android/icon-36-ldpi.png" />
<!-- Use the AndroidWindowSplashScreen preferences for splash screen configurations -->
<preference name="AndroidWindowSplashScreen" value="screen" />
<preference name="AndroidWindowSplashScreenAnimationDuration" value="2000" />
<preference name="AndroidWindowSplashScreenContent" value="res/screen/android/land-ldpi.png" />
<!-- Add more splash screen configurations for other densities -->
</platform>
</widget>
这是我的文件结构 项目根目录 平台 插件 万维网 资源 屏幕 安卓 土地-ldpi.png ios
知道我可以尝试什么,我已经关注了我可以在网上找到的所有资源。任何可以在 2023 年提供帮助的指南我将不胜感激
res/screen/android/land-ldpi.png
。如果路径正确并且启动画面图像仍未显示,则可能是
cordova-plugin-splashscreen
中的已弃用,您应该使用新的启动画面 API。您可以分别使用
cordova-android@11
和
AndroidWindowSplashScreenAnimatedIcon
首选项设置启动屏幕图像和背景颜色:
AndroidWindowSplashScreenBackground
在上面的代码中,<preference name="AndroidWindowSplashScreenAnimatedIcon" value="res/android/splash/xxxhdpi.png" />
<preference name="AndroidWindowSplashScreenBackground" value="#6dADDF" />
是图像文件的路径
,
res/android/splash/xxxhdpi.png
设置整个启动屏幕的背景颜色。*如果您仍然遇到问题,您可能需要删除所有引用已弃用的
#6dADDF
的标签。这些标签可能会导致与新的启动画面 API 发生冲突。