首页 > 解决方案 > 电话间隙闪屏插件不显示图像

问题描述

我正在使用科尔多瓦闪屏插件,由于某种原因,图像未显示,它在代码中指定的秒数内显示闪屏,但未显示确切的图像

这是一个屏幕截图: 这是一个屏幕截图

我尝试将图像添加到多个来源(一次在主文件夹中,一次在 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>

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

我的配置: 我的配置

pgicons 配置: pgicons 配置

这是两个项目的 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 platform add android)我已经尝试删除平台并再次添加它们也使用终端添加了插件,尝试删除它并再次添加它不起作用我使用phonegap检查本地主机/bluestacks android 模拟器/我也尝试使用 adobe phonegap 构建并使用 bluestacks 测试应用程序。该图标工作正常,它只是启动画面

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

标签: cordova-pluginsphonegap-pluginsphonegap

解决方案


在更新启动插件行后,我已经解决了这个问题

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

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

推荐阅读