3

我已按照此页面http://cordova.apache.org/docs/en/3.1.0/cordova_splashscreen_splashscreen.md.html#Splashscreen中的说明来测试启动画面,它需要我将以下代码添加到config ,但以下不是有效的 CML,因此当我构建时出现错误。

<preference name="splashscreen", "splash" />
<preference name="splashScreenDelay", 10000 />

我还尝试将首选项名称更改为有效的 XML,如下所示,它构建成功且没有错误,但是一旦构建后,以下首选项也会自动从 config.XML 中删除

<preference name="splashscreen", value="splash" />
<preference name="splashScreenDelay", value="10000" />

是那个样本的来源,这样我就可以按照它来让我的启动画面工作

4

4 回答 4

3

当我使用 CLI 安装时,功能如下所示:

<feature name="SplashScreen">
  <param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen" />
</feature>

文档说:

<feature name="SplashScreen">
  <param name="android-package" value="org.apache.cordova.SplashScreen" />
</feature>

我使用了这种组合并且它有效:

<preference name="splashscreen" value="splash" />
<preference name="splashScreenDelay" value="10000" />

<feature name="SplashScreen">
   <param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen" />
</feature>
于 2013-10-24T19:31:20.147 回答
3

为了将来参考,上面的答案是旧的。Cordova 4.0 原生支持启动画面,config.xml 中的这个示例应该清楚地说明:

<platform name="android">
    <!-- you can use any density that exists in the Android project -->
    <splash src="res/screen/android/splash-land-hdpi.png" density="land-hdpi"/>
    <splash src="res/screen/android/splash-land-ldpi.png" density="land-ldpi"/>
    <splash src="res/screen/android/splash-land-mdpi.png" density="land-mdpi"/>
    <splash src="res/screen/android/splash-land-xhdpi.png" density="land-xhdpi"/>

    <splash src="res/screen/android/splash-port-hdpi.png" density="port-hdpi"/>
    <splash src="res/screen/android/splash-port-ldpi.png" density="port-ldpi"/>
    <splash src="res/screen/android/splash-port-mdpi.png" density="port-mdpi"/>
    <splash src="res/screen/android/splash-port-xhdpi.png" density="port-xhdpi"/>
</platform>

<platform name="ios">
    <!-- images are determined by width and height. The following are supported -->
    <splash src="res/screen/ios/Default~iphone.png" width="320" height="480"/>
    <splash src="res/screen/ios/Default@2x~iphone.png" width="640" height="960"/>
    <splash src="res/screen/ios/Default-Portrait~ipad.png" width="768" height="1024"/>
    <splash src="res/screen/ios/Default-Portrait@2x~ipad.png" width="1536" height="2048"/>
    <splash src="res/screen/ios/Default-Landscape~ipad.png" width="1024" height="768"/>
    <splash src="res/screen/ios/Default-Landscape@2x~ipad.png" width="2048" height="1536"/>
    <splash src="res/screen/ios/Default-568h@2x~iphone.png" width="640" height="1136"/>
    <splash src="res/screen/ios/Default-667h.png" width="750" height="1334"/>
    <splash src="res/screen/ios/Default-736h.png" width="1242" height="2208"/>
    <splash src="res/screen/ios/Default-Landscape-736h.png" width="2208" height="1242"/>
</platform>
于 2014-12-09T14:08:01.247 回答
2

它应该是:

<preference name="splashscreen" value="splash" />
<preference name="splashScreenDelay" value="10000" />

phonegap 文档通常很狡猾......

于 2013-10-24T07:52:57.237 回答
0

你可以简单地使用 like

<preference name="AutoHideSplashScreen" value="true" />
<preference name="SplashScreenDelay" value="5000" />

AutoHideSplashScreen is allow you to change splash delay time.its defauly TRUE.
于 2018-06-01T09:22:11.590 回答