Cordova 启动画面插件
Cordova Splash Screen Plugin
我正在尝试使用以下插件向我的 Cordova 应用程序添加启动画面:
https://www.npmjs.com/package/com.peerio.cordova.plugin.splashscreen
我已经复制了示例 config.xml 代码并将 src 文件路径更改为我要使用的图像。它提到:
Please notice that the value of the "src" attribute is relative to the project directory and not to the www directory. You can name the source image whatever you like. The internal name in the app is determined by Cordova.
所以基于此我认为我的 src 应该是
/www/img/splash.jpg
?
无论我将其更改为什么,尽管它始终显示 Cordova 徽标。有什么想法吗?
你试过了吗:
<splash src="www/img/splash.jpg" density="land-hdpi"/>
没有前导 /
?
编辑
您正在展示您的 browser
平台。您应该在 platforms/android/res
中查找 Android(如果您正在执行 cordova build android
)。
如果你想要浏览器平台,在文档中有具体的Browser quirk。所以默认情况下,图像 src 位于 platforms/browser
文件夹中的 "/img/logo.png"
中。您必须设置:
<platform name="browser">
<preference name="SplashScreen" value="/images/browser/splashscreen.jpg" />
</platform>
我正在尝试使用以下插件向我的 Cordova 应用程序添加启动画面:
https://www.npmjs.com/package/com.peerio.cordova.plugin.splashscreen
我已经复制了示例 config.xml 代码并将 src 文件路径更改为我要使用的图像。它提到:
Please notice that the value of the "src" attribute is relative to the project directory and not to the www directory. You can name the source image whatever you like. The internal name in the app is determined by Cordova.
所以基于此我认为我的 src 应该是
/www/img/splash.jpg
?
无论我将其更改为什么,尽管它始终显示 Cordova 徽标。有什么想法吗?
你试过了吗:
<splash src="www/img/splash.jpg" density="land-hdpi"/>
没有前导 /
?
编辑
您正在展示您的 browser
平台。您应该在 platforms/android/res
中查找 Android(如果您正在执行 cordova build android
)。
如果你想要浏览器平台,在文档中有具体的Browser quirk。所以默认情况下,图像 src 位于 platforms/browser
文件夹中的 "/img/logo.png"
中。您必须设置:
<platform name="browser">
<preference name="SplashScreen" value="/images/browser/splashscreen.jpg" />
</platform>