PhoneGap SplashScreen无法正常工作

时间:2016-01-27 12:22:04

标签: android ios cordova phonegap-build

今天我使用Splashscreens为不同的分辨率带来了很多麻烦。

我在config.xml中的启动:

    

<gap:splash src="Splash_1536x2048_Leopold_City.png" gap:platform="ios" width="1536" height="2048" />
<gap:splash src="Splash_2048x1536_Leopold_City.png" gap:platform="ios" width="2048" height="1536" />

<gap:splash src="Splash_320x480_Leopold_City.png" gap:platform="ios" width="320" height="480" />
<gap:splash src="Splash_480x320_Leopold_City.png" gap:platform="ios" width="480" height="320" />

<gap:splash src="Splash_640x960_Leopold_City.png" gap:platform="ios" width="640" height="960" />
<gap:splash src="Splash_960x640_Leopold_City.png" gap:platform="ios" width="960" height="640" />

<gap:splash src="Splash_640x1136_Leopold_City.png" gap:platform="ios" width="640" height="1136" />
<gap:splash src="Splash_1136x640_Leopold_City.png" gap:platform="ios" width="1136" height="640" />

<gap:splash src="Splash_750x1334_Leopold_City.png" gap:platform="ios" width="750" height="1334" />
<gap:splash src="Splash_1334x1334_Leopold_City.png" gap:platform="ios" width="1334" height="750" />

<gap:splash src="Splash_1242x2208_Leopold_City.png" gap:platform="ios" width="1242" height="2208" />
<gap:splash src="Splash_2208x1242_Leopold_City.png" gap:platform="ios" width="2208" height="1242" />

这些png文件存储在root,/ splash和res / screen / ios中,但即使我将XML中的路径更改为某些可能的文件位置,图像也不会在应用程序启动时加载。

如果我使用:

<!--iPhone and iPod touch-->
<gap:splash src="splash.png" gap:platform="ios" width="320" height="480" />
<gap:splash src="splash.png" gap:platform="ios" width="640" height="960" />

<!-- iPhone 5 / iPod Touch (5th Generation) -->
<!--<gap:splash src="Default-568h@2x.png" gap:platform="ios" width="640" height="1136" />-->
<gap:splash src="splash.png" gap:platform="ios" width="640" height="1136" />

<!-- iPhone 6 -->
<!--<gap:splash src="Default-667h@2x.png" gap:platform="ios" width="750" height="1334" />-->
<gap:splash src="splash.png" gap:platform="ios" width="750" height="1334" />
<!--<gap:splash src="Default-Portrait-736h@3x.png" gap:platform="ios" width="1242" height="2208" />-->
<gap:splash src="splash.png" gap:platform="ios" width="1242" height="2208" />
<!--<gap:splash src="Default-Landscape-736h@3x.png" gap:platform="ios" width="2208" height="1242" />-->
<gap:splash src="splash.png" gap:platform="ios" width="2208" height="1242" />

<!--iPad -->
<gap:splash src="splash.png" gap:platform="ios" width="768" height="1024" />
<gap:splash src="splash.png" gap:platform="ios" width="1024" height="768" />

<!--Retina iPad -->
<gap:splash src="splash.png" gap:platform="ios" width="1536" height="2048" />
<gap:splash src="splash.png" gap:platform="ios" width="2048" height="1536" />

显示默认的启动画面。但我想将不同的图像用于不同的分辨率......

请帮帮我: - )

3 个答案:

答案 0 :(得分:0)

请仔细阅读以下链接。可能有帮助。

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

答案 1 :(得分:0)

如果使用Phonegap Build构建应用程序,则根文件夹中应该有一个splash.png。尝试添加特定于平台的启动屏幕,如下所示。您可以更改的文件名和路径。

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

    <gap:splash src="res/screen/ios/screen-iphone-portrait.png"    gap:platform="ios"     width="320" height="480" />
    <gap:splash src="res/screen/ios/screen-iphone-portrait-2x.png" gap:platform="ios"     width="640" height="960" />
    <gap:splash src="res/screen/ios/screen-ipad-portrait.png"          gap:platform="ios"     width="768" height="1024" />
    <gap:splash src="res/screen/ios/screen-ipad-portrait-2x.png"       gap:platform="ios"     width="1536" height="2048" />
    <gap:splash src="res/screen/ios/screen-iphone-portrait-568h-2x.png" gap:platform="ios" width="640" height="1136"  />
    <gap:splash src="res/screen/ios/screen-ipad-landscape.png"     gap:platform="ios"     width="1024" height="768" />
    <gap:splash src="res/screen/ios/screen-ipad-landscape-2x.png"     gap:platform="ios"     width="2048" height="1536" />
    <gap:splash src="res/screen/ios/screen-iphone-landscape.png"    gap:platform="ios"     width="480" height="320" />
    <gap:splash src="res/screen/ios/screen-iphone-landscape-2x.png" gap:platform="ios"     width="960" height="640" />
    <gap:splash src="res/screen/ios/Default-667h@2x.png" gap:platform="ios" width="750" height="1334" />
    <gap:splash src="res/screen/ios/Default-Portrait-736h@3x.png" gap:platform="ios" width="1242" height="2208" />
    <gap:splash src="res/screen/ios/Default-Landscape-736h@3x.png" gap:platform="ios" width="2208" height="1242" />

答案 2 :(得分:0)

这是我的config.xml的当前版本。这不起作用......

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

    

<gap:splash src="Splash_1536x2048_Leopold_City.png" gap:platform="ios" width="1536" height="2048" />
<gap:splash src="Splash_2048x1536_Leopold_City.png" gap:platform="ios" width="2048" height="1536" />

<gap:splash src="Splash_320x480_Leopold_City.png" gap:platform="ios" width="320" height="480" />
<gap:splash src="Splash_480x320_Leopold_City.png" gap:platform="ios" width="480" height="320" />

<gap:splash src="Splash_640x960_Leopold_City.png" gap:platform="ios" width="640" height="960" />
<gap:splash src="Splash_960x640_Leopold_City.png" gap:platform="ios" width="960" height="640" />

<gap:splash src="Splash_640x1136_Leopold_City.png" gap:platform="ios" width="640" height="1136" />
<gap:splash src="Splash_1136x640_Leopold_City.png" gap:platform="ios" width="1136" height="640" />

<gap:splash src="Splash_750x1334_Leopold_City.png" gap:platform="ios" width="750" height="1334" />
<gap:splash src="Splash_1334x1334_Leopold_City.png" gap:platform="ios" width="1334" height="750" />

<gap:splash src="Splash_1242x2208_Leopold_City.png" gap:platform="ios" width="1242" height="2208" />
<gap:splash src="Splash_2208x1242_Leopold_City.png" gap:platform="ios" width="2208" height="1242" />