PhoneGap的构建不显示启动画面 [英] phonegap build not showing splashscreen

查看:435
本文介绍了PhoneGap的构建不显示启动画面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题已经被问在过去,但没有一个答案,我发现已经解决了这个问题对我来说。

我试图做一个非常简单的PhoneGap的应用程序来显示启动画面,并宣布时,它已准备就绪。这仅仅是一个测试程序,以解决如何使用闪屏。

  • 在我通过PhoneGap的CLI中使用PhoneGap的构建。
  • 在PhoneGap的版本3.5.0
  • 在Android上只测试

我有一个WWW文件夹,其中的config.xml 的位置。所有splashscreens都设在 WWW / RES /屏幕/<平台> /filename.png

我的配置文件是

 < XML版本=1.0编码=UTF-8&GT?;
<微件ID =uk.co.workshop14.splashscreen,例如应用程序内的版本=0.1.0的xmlns =htt​​p://www.w3.org/ns/widgets的xmlns:缺口=HTTP:/ /phonegap.com/ns/1.0">
    <名称>闪屏,例如,应用程序< /名称>
    <描述>
        响应该deviceready事件的Hello World示例应用程序。
    < /描述>
    <作者电子邮件=support@phonegap.com的href =htt​​p://phonegap.com>
        彼得
    < /笔者>

    < preference名=权限的价值=无​​/>
    < preference名=PhoneGap的版本值=3.5.0/>
    < preference名=方向值=默认/>
    < preference名=目标设备值=万能/>
    < preference名=全屏值=真/>
    < preference名=webviewbounce值=真/>
    < preference NAME =prerendered图标值=真/>
    < preference名=留合的WebView值=FALSE/>
    < preference名=IOS-statusbarstyle值=黑色不透明/>
    < preference名称=检测数据类型值=真/>
    < preference名=退出上挂起值=FALSE/>
    < preference名=显示,启动画面微调值=真/>
    < preference NAME =自动隐藏,闪屏的价值=FALSE/>
    < preference名=SplashScreenDelay值=10000/>
    < preference名=禁用光标值=FALSE/>
    < preference名=Android的的minSdkVersion值=7/>
    < preference名=Android的INSTALLLOCATION值=自动/>

    <差距:插件名称=org.apache.cordova.device/>
    <差距:插件名称=org.apache.cordova.splashscreen/>

    <图标SRC =的icon.png/>
    <图标差距:平台=Android的差距:预选赛=LDPISRC =RES /图标/安卓/图标-36-ldpi.png/>
    <图标差距:平台=Android的差距:预选赛=MDPISRC =RES /图标/安卓/图标-48-mdpi.png/>
    <图标差距:平台=Android的差距:预选赛=华电国际SRC =RES /图标/安卓/图标-72-hdpi.png/>
    <图标差距:平台=Android的差距:预选赛=xhdpiSRC =RES /图标/安卓/图标-96 xhdpi.png/>
    <图标差距:平台=黑莓SRC =RES /图标/黑莓/图标80.png/>
    <图标差距:平台=黑莓的差距:状态=悬停SRC =RES /图标/黑莓/图标80.png/>
    <图标差距:平台=IOS高度=57SRC =RES /图标/ IOS /图标57.pngWIDTH =57/>
    <图标差距:平台=IOS高度=72SRC =RES /图标/ IOS /图标72.pngWIDTH =72/>
    <图标差距:平台=IOS高度=114SRC =RES /图标/ IOS /图标57-2x.pngWIDTH =114/>
    <图标差距:平台=IOS高度=144SRC =RES /图标/ IOS /图标72-2x.pngWIDTH =144/>
    <图标差距:平台=webOS的SRC =RES /图标/的webOS /图标64.png/>
    <图标差距:平台=winphoneSRC =RES /图标/ Windows的手机/图标48.png/>
    <图标差距:平台=winphone的差距:角色=背景SRC =RES /图标/ Windows的手机/图标173.png/>

    <差距:飞溅的差距:平台=Android的差距:预选赛=港LDPISRC =RES /屏幕/安卓/屏幕LDPI-portrait.png/>
    <差距:飞溅的差距:平台=Android的差距:预选赛=港MDPISRC =RES /屏幕/安卓/屏幕MDPI-portrait.png/>
    <差距:飞溅的差距:平台=Android的差距:预选赛=港华电国际SRC =RES /屏幕/安卓/屏幕HDPI-portrait.png/>
    <差距:飞溅的差距:平台=Android的差距:预选赛=港xhdpiSRC =RES /屏幕/安卓/屏幕xhdpi-portrait.png/>
    <差距:飞溅的差距:平台=黑莓SRC =RES /屏幕/黑莓/屏幕225.png/>
    <差距:飞溅的差距:平台=IOS高度=480SRC =RES /屏幕/ IOS /屏幕与iPhone portrait.pngWIDTH =320/>
    <差距:飞溅的差距:平台=IOS高度=960SRC =RES /屏幕/ IOS /屏幕iphone画像,2x.pngWIDTH =640/>
    <差距:飞溅的差距:平台=IOS高度=1136SRC =RES /屏幕/ IOS /屏幕iphone画像-568h-2x.pngWIDTH =640/>
    <差距:飞溅的差距:平台=IOS高度=1024SRC =RES /屏幕/ IOS /屏幕的iPad,portrait.pngWIDTH =768/>
    <差距:飞溅的差距:平台=IOS高度=768SRC =RES /屏幕/ IOS /屏幕的iPad,landscape.pngWIDTH =1024/>
    <差距:飞溅的差距:平台=winphoneSRC =RES /屏幕/窗口电话/屏幕portrait.jpg/>

    <获得原产地=*/>
< /部件>
 

解决方案

您没有默认的飞溅的标签是

 <差距:飞溅SRC =splash.png/>
 

这是在文档中:<一href="http://docs.build.phonegap.com/en_US/configuring_icons_and_splash.md.html#Icons%20and%20Splash%20Screens" rel="nofollow">http://docs.build.phonegap.com/en_US/configuring_icons_and_splash.md.html#Icons%20and%20Splash%20Screens

更新

如果您正在使用PhoneGap的版本CLI-5.1.1或以上,你需要从NPM新的闪屏插件。

下面是在GitHub上新的插件,那里你可以找到如何使用它:

https://github.com/apache/cordova-plugin-splashscreen

This question has been asked in the past but none of the answers that I have found have solved the problem for me.

I am trying to make a very simple phonegap app to show a splash screen and announce when it is ready. It is just a test app to work out how to use the splash screen.

  • I am using phonegap build through the phonegap cli.
  • phonegap version 3.5.0
  • tested on android only

I have a www folder where config.xml is located. All the splashscreens are located within www/res/screen/<platform>/filename.png

my config file is

<?xml version='1.0' encoding='utf-8'?>
<widget id="uk.co.workshop14.splashscreen-example-app" version="0.1.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
    <name>splashscreen-example-app</name>
    <description>
        Hello World sample application that responds to the deviceready event.
    </description>
    <author email="support@phonegap.com" href="http://phonegap.com">
        Peter
    </author>

    <preference name="permissions" value="none" />
    <preference name="phonegap-version" value="3.5.0" />
    <preference name="orientation" value="default" />
    <preference name="target-device" value="universal" />
    <preference name="fullscreen" value="true" />
    <preference name="webviewbounce" value="true" />
    <preference name="prerendered-icon" value="true" />
    <preference name="stay-in-webview" value="false" />
    <preference name="ios-statusbarstyle" value="black-opaque" />
    <preference name="detect-data-types" value="true" />
    <preference name="exit-on-suspend" value="false" />
    <preference name="show-splash-screen-spinner" value="true" />
    <preference name="auto-hide-splash-screen" value="false" />
    <preference name="SplashScreenDelay" value="10000" />
    <preference name="disable-cursor" value="false" />
    <preference name="android-minSdkVersion" value="7" />
    <preference name="android-installLocation" value="auto" />

    <gap:plugin name="org.apache.cordova.device" />
    <gap:plugin name="org.apache.cordova.splashscreen" />

    <icon src="icon.png" />
    <icon gap:platform="android" gap:qualifier="ldpi" src="res/icon/android/icon-36-ldpi.png" />
    <icon gap:platform="android" gap:qualifier="mdpi" src="res/icon/android/icon-48-mdpi.png" />
    <icon gap:platform="android" gap:qualifier="hdpi" src="res/icon/android/icon-72-hdpi.png" />
    <icon gap:platform="android" gap:qualifier="xhdpi" src="res/icon/android/icon-96-xhdpi.png" />
    <icon gap:platform="blackberry" src="res/icon/blackberry/icon-80.png" />
    <icon gap:platform="blackberry" gap:state="hover" src="res/icon/blackberry/icon-80.png" />
    <icon gap:platform="ios" height="57" src="res/icon/ios/icon-57.png" width="57" />
    <icon gap:platform="ios" height="72" src="res/icon/ios/icon-72.png" width="72" />
    <icon gap:platform="ios" height="114" src="res/icon/ios/icon-57-2x.png" width="114" />
    <icon gap:platform="ios" height="144" src="res/icon/ios/icon-72-2x.png" width="144" />
    <icon gap:platform="webos" src="res/icon/webos/icon-64.png" />
    <icon gap:platform="winphone" src="res/icon/windows-phone/icon-48.png" />
    <icon gap:platform="winphone" gap:role="background" src="res/icon/windows-phone/icon-173.png" />

    <gap:splash gap:platform="android" gap:qualifier="port-ldpi" src="res/screen/android/screen-ldpi-portrait.png" />
    <gap:splash gap:platform="android" gap:qualifier="port-mdpi" src="res/screen/android/screen-mdpi-portrait.png" />
    <gap:splash gap:platform="android" gap:qualifier="port-hdpi" src="res/screen/android/screen-hdpi-portrait.png" />
    <gap:splash gap:platform="android" gap:qualifier="port-xhdpi" src="res/screen/android/screen-xhdpi-portrait.png" />
    <gap:splash gap:platform="blackberry" src="res/screen/blackberry/screen-225.png" />
    <gap:splash gap:platform="ios" height="480" src="res/screen/ios/screen-iphone-portrait.png" width="320" />
    <gap:splash gap:platform="ios" height="960" src="res/screen/ios/screen-iphone-portrait-2x.png" width="640" />
    <gap:splash gap:platform="ios" height="1136" src="res/screen/ios/screen-iphone-portrait-568h-2x.png" width="640" />
    <gap:splash gap:platform="ios" height="1024" src="res/screen/ios/screen-ipad-portrait.png" width="768" />
    <gap:splash gap:platform="ios" height="768" src="res/screen/ios/screen-ipad-landscape.png" width="1024" />
    <gap:splash gap:platform="winphone" src="res/screen/windows-phone/screen-portrait.jpg" />

    <access origin="*" />
</widget>

解决方案

You don't have the default splash tag which is

<gap:splash src="splash.png" />

It's in the documentation: http://docs.build.phonegap.com/en_US/configuring_icons_and_splash.md.html#Icons%20and%20Splash%20Screens

Update

If you are using phonegap version cli-5.1.1 or above, you need the new splashscreen plugin from npm.

Here's the new plugin on github, there you can find how to use it:

https://github.com/apache/cordova-plugin-splashscreen

这篇关于PhoneGap的构建不显示启动画面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆