Apache Cordova自定义启动屏幕在Android和iOS中不可见

时间:2019-04-10 08:10:46

标签: android ios angular cordova splash-screen

我正在与Angular 7项目一起运行Apache Cordova 8.1.2。我已安装SplashScreen插件并按照this documentation中所述更改了config.xml。 这是我的config.xml

<platform name="android">
        <icon density="ldpi" src="projects/cys-mobile-app/src/assets/img/android/display-icon/ldpi.png" />
        <icon density="mdpi" src="projects/cys-mobile-app/src/assets/img/android/display-icon/mdpi.png" />
        <icon density="hdpi" src="projects/cys-mobile-app/src/assets/img/android/display-icon/hdpi.png" />
        <icon density="xhdpi" src="projects/cys-mobile-app/src/assets/img/android/display-icon/xhdpi.png" />
        <icon density="xxhdpi" src="projects/cys-mobile-app/src/assets/img/android/display-icon/xxhdpi.png" />
        <icon density="xxxhdpi" src="projects/cys-mobile-app/src/assets/img/android/display-icon/xxxhdpi.png" />
        <splash density="land-hdpi" src="projects/cys-mobile-app/src/assets/img/android/splash-screen/splash-land-hdpi.png" />
        <splash density="land-ldpi" src="projects/cys-mobile-app/src/assets/img/android/splash-screen/splash-land-ldpi.png" />
        <splash density="land-mdpi" src="projects/cys-mobile-app/src/assets/img/android/splash-screen/splash-land-mdpi.png" />
        <splash density="land-xhdpi" src="projects/cys-mobile-app/src/assets/img/android/splash-screen/splash-land-xhdpi.png" />
        <splash density="land-xxhdpi" src="projects/cys-mobile-app/src/assets/img/android/splash-screen/splash-land-xxhdpi.png" />
        <splash density="land-xxxhdpi" src="projects/cys-mobile-app/src/assets/img/android/splash-screen/splash-land-xxxhdpi.png" />
    </platform>
    <platform name="ios">
        <splash src="projects/cys-mobile-app/src/assets/img/ios/splash-screen/splash-2732.png" />
        <icon height="180" src="projects/cys-mobile-app/src/assets/img/ios/Icon-App-60x60@3x.png" width="180" />
        <icon height="60" src="projects/cys-mobile-app/src/assets/img/ios/Icon-App-60x60@2x.png" width="60" />
        <icon height="120" src="projects/cys-mobile-app/src/assets/img/ios/Icon-App-60x60@2x.png" width="120" />
        <icon height="76" src="projects/cys-mobile-app/src/assets/img/ios/Icon-App-76x76@1x.png" width="76" />
        <icon height="152" src="projects/cys-mobile-app/src/assets/img/ios/Icon-App-76x76@2x.png" width="152" />
        <icon height="40" src="projects/cys-mobile-app/src/assets/img/ios/Icon-App-40x40@1x.png" width="40" />
        <icon height="80" src="projects/cys-mobile-app/src/assets/img/ios/Icon-App-40x40@2x.png" width="80" />
    </platform>
<preference name="SplashScreenDelay" value="10000" />
<plugin name="cordova-plugin-splashscreen" spec="^5.0.2" />

使用上述代码,我可以在ios中看到默认的cordova启动屏幕,在Android中可以看到黑色屏幕,其中有一个微调框。 图标工作正常,但初始屏幕未成功。我希望我在启动标签中提供的自定义图像应该在启动屏幕上可见。

我还尝试了Apache Cordova splash screens not showing in Android中给出的所有解决方案。

所有图像文件也都就位。我在这里想念什么?

1 个答案:

答案 0 :(得分:0)

您似乎没有为Android列出任何人像启动屏幕,而对于iOS,则没有列出任何人像启动屏幕。在android部分,您要添加:

<splash density="port-mdpi" src="projects/cys-mobile-app/src/assets/img/android/splash-screen/splash1.png" />
<splash density="port-hdpi" src="projects/cys-mobile-app/src/assets/img/android/splash-screen/splash2.png" />
...

对于iOS,您需要像这样添加它们:

<splash height="480" src="projects/cys-mobile-app/src/assets/img/android/splash-screen/splash1.png" width="320" />
<splash height="960" src="projects/cys-mobile-app/src/assets/img/android/splash-screen/splash2.png" width="640" />
...

在这里,您需要确定高度和宽度属性的所有纵向和横向配置。