启动应用程序时不会出现启动画面。 PhoneGap / Cordova

问题描述 投票:0回答:1

我正在使用PhoneGap桌面应用程序和PhoneGap Build来制作和编译Android应用程序。我想在应用程序的开头显示启动屏幕,因为我要在后台执行一些加载工作,一旦加载完成,我就会隐藏启动屏幕并显示内容。

我正在使用“ cordova-plugin-splashscreen v5.0.2”,我使用此代码来显示和隐藏初始屏幕:

//Show Splash Screen
navigator.splashscreen.show();

//Hide splash Screen after loading has finished
navigator.splashscreen.hide();

这是我的config.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">
    <name>NexusPhoneGap</name>
    <description>
        A blank PhoneGap app.
    </description>
    <author email="[email protected]" href="http://phonegap.com">
        PhoneGap Team
    </author>
    <content src="index.html" />
    <access origin="*" />

    <plugin name="cordova-plugin-inappbrowser" spec="^3.0.0" />
    <plugin name="cordova-plugin-splashscreen" spec="^5.0.2" />
    <plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
    <plugin name="cordova-plugin-network-information" spec="^2.0.1" />

    <platform name="android">
        <splash src="splashScreens/screen-hdpi-portrait.png" density="port-hdpi"/>
        <splash src="splashScreens/screen-ldpi-portrait.png" density="port-ldpi"/>
        <splash src="splashScreens/screen-mdpi-portrait.png" density="port-mdpi"/>
        <splash src="splashScreens/screen-xhdpi-portrait.png" density="port-xhdpi"/>
    </platform>

</widget>

我将启动屏幕放在一个名为启动“ splashScreens”的文件夹中,如您在config.xml中看到的。问题是没有出现启动画面。我看到的是空白屏幕,而不是启动屏幕。知道如何显示初始屏幕吗?

cordova cordova-plugins phonegap-plugins phonegap
1个回答
0
投票

我为此苦了很长时间。我也有一个旧的非标准项目配置和路径。将“密度”更改为“限定词”是可行的。所以改变至

© www.soinside.com 2019 - 2024. All rights reserved.