手机间隙启动画面插件未显示图片

时间:2018-07-16 09:14:40

标签: cordova-plugins phonegap-plugins phonegap

我正在使用cordova初始屏幕插件,由于某种原因,图像未显示,因此在代码中指定的秒数内显示了初始屏幕,但未显示确切的图像

以下是屏幕截图: here is a screen-shot

我尝试将图像添加到多个源(一次在主文件夹中,一次在www文件夹中,如果那是已知的事情,尝试将所有图像添加到可绘制文件夹中,还尝试了https://pgicons.abiro.com/和其xml文件存在相同问题)

这是我的xml代码

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.phonegap.helloworld" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
  <platform name="android">
    <!-- you can use any density that exists in the Android project 
<splash src="splash.png" />

-->
    <splash src="www/res/screen/android/ldpi.png" density="land-ldpi" />
    <splash src="www/res/screen/android/mdpi.png" density="land-mdpi"  />
    <splash src="www/res/screen/android/hdpi.png" density="land-hdpi"/>
    <splash src="www/res/screen/android/xhdpi.png" density="land-xhdpi"  />
    <splash src="www/res/screen/android/xxhdpi.png" density="land-xxhdpi"  />

         <platform name="ios">

      <splash platform="ios" src="www/res/screen/ios/320x480.png" width="320" height="480"/>
    <splash platform="ios" src="www/res/screen/ios/640x960.png" width="640" height="960"/>
    <splash platform="ios" src="www/res/screen/ios/768x1024.png" width="768" height="1024"/>
    <splash platform="ios" src="www/res/screen/ios/1536x2048.png" width="1536" height="2048"/>
    <splash platform="ios" src="www/res/screen/ios/640x1136.png" width="640" height="1136"/>
    <splash platform="ios" src="www/res/screen/ios/750x1334.png" width="750" height="1334"/>
    <splash platform="ios" src="www/res/screen/ios/2208x1242.png" width="2208" height="1242"/>
    <splash platform="ios" src="www/res/screen/ios/1242x2208.png" width="1242" height="2208"/>
    </platform>


        <platform name="browser">
    <preference name="SplashScreen" value="screen.png" /> <!-- defaults to "/img/logo.png" -->
    <preference name="SplashScreenWidth" value="600" /> <!-- defaults to "170" -->
    <preference name="SplashScreenHeight" value="300" /> <!-- defaults to "200" -->
</platform>


</platform>  

    <preference name="SplashScreen" value="screen"/>
    <preference name="SplashScreenDelay" value="5000" />
    <name>Project</name>
    <description>
        A blank PhoneGap app.
    </description>
    <author email="support@phonegap.com" href="http://phonegap.com">
        PhoneGap Team
    </author>
    <content src="index.html" />
    <access origin="*" />
</widget>

这是https://pgicons.abiro.com/

生成的xml代码
<?xml version='1.0' encoding='utf-8'?>
<widget xmlns="http://www.w3.org/ns/widgets">
    <splash src="splash.png" />
    <platform name="ios">
        <icon height="1024" src="res/icon/ios/icon-1024.png" width="1024" />
        <icon height="29" src="res/icon/ios/icon-small.png" width="29" />
        <icon height="58" src="res/icon/ios/icon-small@2x.png" width="58" />
        <icon height="87" src="res/icon/ios/icon-small@3x.png" width="87" />
        <icon height="40" src="res/icon/ios/icon-small-40.png" width="40" />
        <icon height="80" src="res/icon/ios/icon-small-40@2x.png" width="80" />
        <icon height="120" src="res/icon/ios/icon-small-40@3x.png" width="120" />
        <icon height="50" src="res/icon/ios/icon-small-50.png" width="50" />
        <icon height="100" src="res/icon/ios/icon-small-50@2x.png" width="100" />
        <icon height="57" src="res/icon/ios/icon.png" width="57" />
        <icon height="114" src="res/icon/ios/icon@2x.png" width="114" />
        <icon height="60" src="res/icon/ios/icon-60.png" width="60" />
        <icon height="120" src="res/icon/ios/icon-60@2x.png" width="120" />
        <icon height="180" src="res/icon/ios/icon-60@3x.png" width="180" />
        <icon height="72" src="res/icon/ios/icon-72.png" width="72" />
        <icon height="144" src="res/icon/ios/icon-72@2x.png" width="144" />
        <icon height="76" src="res/icon/ios/icon-76.png" width="76" />
        <icon height="152" src="res/icon/ios/icon-76@2x.png" width="152" />
        <icon height="167" src="res/icon/ios/icon-167.png" width="167" />
        <icon height="167" src="res/icon/ios/icon-83.5@2x.png" width="167" />
        <splash src="res/screen/ios/Default@2x~iphone~anyany.png" />
        <splash src="res/screen/ios/Default@2x~iphone~comany.png" />
        <splash src="res/screen/ios/Default@3x~iphone~anyany.png" />
        <splash src="res/screen/ios/Default@3x~iphone~comany.png" />
        <splash src="res/screen/ios/Default@2x~ipad~anyany.png" />
        <splash src="res/screen/ios/Default@2x~ipad~comany.png" />
    </platform>
    <platform name="android">
        <preference name="SplashMaintainAspectRatio" value="true" />
        <preference name="SplashShowOnlyFirstTime" value="true" />
        <icon density="ldpi" src="res/icon/android/ldpi.png" />
        <icon density="mdpi" src="res/icon/android/mdpi.png" />
        <icon density="hdpi" src="res/icon/android/hdpi.png" />
        <icon density="xhdpi" src="res/icon/android/xhdpi.png" />
        <icon density="xxhdpi" src="res/icon/android/xxhdpi.png" />
        <icon density="xxxhdpi" src="res/icon/android/xxxhdpi.png" />
        <splash density="port-ldpi" src="res/screen/android/splash-port-ldpi.png" />
        <splash density="port-mdpi" src="res/screen/android/splash-port-mdpi.png" />
        <splash density="port-hdpi" src="res/screen/android/splash-port-hdpi.png" />
        <splash density="port-xhdpi" src="res/screen/android/splash-port-xhdpi.png" />
        <splash density="port-xxhdpi" src="res/screen/android/splash-port-xxhdpi.png" />
        <splash density="port-xxxhdpi" src="res/screen/android/splash-port-xxxhdpi.png" />
        <splash density="port-ldpi" src="www/res/drawable-port-ldpi/splash-port-ldpi.png" />
        <splash density="port-mdpi" src="www/res/drawable-port-mdpi/splash-port-mdpi.png" />
        <splash density="port-hdpi" src="www/res/drawable-port-hdpi/splash-port-hdpi.png" />
        <splash density="port-xhdpi" src="www/res/drawable-port-xhdpi/splash-port-xhdpi.png" />
        <splash density="port-xxhdpi" src="www/res/drawable-port-xxhdpi/splash-port-xxhdpi.png" />
        <splash density="port-xxxhdpi" src="www/res/drawable-port-xxxhdpi/splash-port-xxxhdpi.png" />
    </platform>
    <preference name="SplashScreen" value="screen" />
    <preference name="SplashScreenDelay" value="5000" />
    <name>Splash screen Project</name>
    <description>
        A PhoneGap app to test splash screen.
    </description>
    <author>
        Sara
    </author>
</widget>

这是项目文件夹和图像源的屏幕截图

我的配置: my configuration

pgicons配置: pgicons configuration

这是两个项目的indx.html代码

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
        <title>current location</title>

        <script type="text/javascript" charset="utf-8">
        </script>
    </head>

            <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
         <body>
    <h1>hello</h1>
        <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
    </body>


</html>

我已经使用终端添加了平台(cordova平台添加了android),我试图删除平台并再次添加它们 插件也是使用终端添加的,尝试将其删除并再次添加后无法正常工作 我检查使用phonegap本地主机/ bluestacks android模拟器/我也尝试过使用adobe phonegap构建并使用bluestacks测试应用程序。该图标可以正常工作,仅其初始屏幕

如果您需要我添加任何详细信息,请随时询问 我现在在这里呆了一个星期,我被分配在两天内完成:(

1 个答案:

答案 0 :(得分:0)

更新初始插件行

后,我已经解决了此问题

来自

   <plugin name="cordova-plugin-splashscreen" source="npm" />

   <plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
  • 添加了适用的规范后