PhoneGap Build Android Not Displaying Splashscreen

后端 未结 1 1264
渐次进展
渐次进展 2021-01-17 02:03

Here is my code in my config.xml that\'s relative to splash screens:

    
    
    

        
相关标签:
1条回答
  • 2021-01-17 02:43

    I created one sample for you and I checked in device and splash screen is appeared.

    Add the plugin

    cordova-plugin-splashscreen

    index.html

    <!DOCTYPE html>
    <html>
      <head>
        <title>Splashscreen Example</title>
    
        <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
        <script type="text/javascript" src="js/PushNotification.js"></script>
        <script type="text/javascript" src="js/index.js"></script>
        <script type="text/javascript" charset="utf-8">
    
        // Wait for device API libraries to load
        //
        document.addEventListener("deviceready", onDeviceReady, false);
    
        // device APIs are available
        //
        function onDeviceReady() {
            navigator.splashscreen.show();
        }
    
        </script>
      </head>
      <body>
        <h1>Example</h1>
      </body>
    </html>
    

    config.xml

        <preference name="SplashScreen" value="screen" />
        <preference name="SplashScreenDelay" value="3000" />
        <platform name="android">            
                <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
                <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
                <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
                <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
                <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
                <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
            </platform>
    <plugin name="cordova-plugin-splashscreen" spec="~3.2.1" />
    

    I created one folder named "resources" and add the splash screen images and give its path in config.xml file.

    And it's working.

    0 讨论(0)
提交回复
热议问题