我正在使用cordova-plugin-splashscreen来显示启动画面 .
https://www.npmjs.com/package/cordova-plugin-splashscreen
它以前工作,但它不适用于新版本 . 这是我的配置文件:
<?xml version='1.0' encoding='utf-8'?>
<widget id="in.fifa" version="1.0" versionCode="005" xmlns:gap = "http://phonegap.com/ns/1.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>FIFA18</name>
<description>
Sample Description
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Author Name
</author>
<content src="index.html" />
<plugin name="cordova-plugin-whitelist" version="1"/>
<plugin name="cordova-plugin-splashscreen"/>
<platform name="android">
<splash src="screen.png" density="port-hdpi"/>
<splash src="screen.png" density="port-ldpi"/>
<splash src="screen.png" density="port-mdpi"/>
<splash src="screen.png" density="port-xhdpi"/>
</platform>
<icon src="icon.png" />
<preference name="SplashScreenDelay" value="1500"/>
<preference name="FadeSplashScreen" value="false"/>
<preference name="Orientation" value="portrait"/>
<preference name="LoadUrlTimeoutValue" value="40000"/>
<preference name="StatusBarOverlaysWebView" value="true"/>
<access origin="*" />
<allow-navigation href="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
<preference name="android-minSdkVersion" value="15"/>
<preference name="android-targetSdkVersion" value="23"/>
<preference name="multiDexEnabled" value="true"/>
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
项目根文件夹中提供了启动画面图像 . 是否需要更改代码?谢谢!
1 回答
确保"screen.png"位于cordova项目文件夹中 . 如果您已将文件移动到
YOUR_CORDOVA_PROJECT/res/img/screen/screen.png
之类的内容,那么您需要在config.xml中尊重该路径,如下所示:如果这不能解决问题,请确保您的config.xml结构与此示例中的结构匹配:
另外,请确保您没有在横向模式下测试设备上的启动画面,因为您只在提供的代码段中添加了纵向模式的配置 .