Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Cordova flash screen

May 21, 2021 Cordova

Table of contents

This plug-in is used to display the startup screen when the application starts.

Step 1 - Install the Splash Screen plug-in

You can install the Splash screen plug-in in the command prompt window by running the following code.

C:\Users\username\Desktop\CordovaProject>cordova plugin add cordova-plugin-splashscreen

Step 2 - Add a splash screen

Adding a startup screen is different from adding other Cordova plug-ins. /b10> We need to .xml and add the following snippets to the widget element.

The first snipper is SplashScreen. /b10> It has the value property, which is the name of the image in the platform / android / res / drawable - folder. /b11> Cordova provides the default screen images we use .png example, but you may need to add your own. /b12> It is important to add images for portrait and landscape views and overlay different screen sizes.

<preference name = "SplashScreen" value = "screen" />

For the second clip, we need to add SplashScreenDelay. /b10> We are setting the value to 3000 to hide the splash screen after three seconds.

<preference name = "SplashScreenDelay" value = "3000" />

The last preference is optional. /b10> If the value is set to true, the image will not stretch to fit the screen. /b11> If set to false, it will be stretched.

<preference name = "SplashMaintainAspectRatio" value = "true" />

Now, when we run the application, we'll see a splash screen.

Cordova flash screen