Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

phonegap / cordova splash screen aspect ratio issue

I create my phonegap app and everythings works, but the splash screen makes me crazy. It will be shown but not in perfect aspect ratio (tested on nexus 6). It will be squeezed in the width.

My current splash screen config.xml

<gap:splash src="www/res/screen/android/land_xxhdpi.png" />
<gap:splash src="www/res/screen/android/ldpi.png" gap:platform="android" gap:qualifier="port-ldpi"/>
<gap:splash src="www/res/screen/android/mdpi.png" gap:platform="android" gap:qualifier="port-mdpi"/>
<gap:splash src="www/res/screen/android/hdpi.png" gap:platform="android" gap:qualifier="port-hdpi"/>
<gap:splash src="www/res/screen/android/xhdpi.png" gap:platform="android" gap:qualifier="port-xhdpi"/>
<gap:splash src="www/res/screen/android/xxhdpi.png" gap:platform="android" gap:qualifier="port-xxhdpi"/>
<gap:splash src="www/res/screen/android/land_ldpi.png" gap:platform="android" gap:qualifier="land-ldpi"/>
<gap:splash src="www/res/screen/android/land_mdpi.png" gap:platform="android" gap:qualifier="land-mdpi"/>
<gap:splash src="www/res/screen/android/land_hdpi.png" gap:platform="android" gap:qualifier="land-hdpi"/>
<gap:splash src="www/res/screen/android/land_xhdpi.png" gap:platform="android" gap:qualifier="land-xhdpi"/>
<gap:splash src="www/res/screen/android/land_xxhdpi.png" gap:platform="android" gap:qualifier="land-xxhdpi"/>

<preference name="SplashScreenBackgroundColor" value="#e8413d" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3500" />
<preference name="SplashMaintainAspectRatio" value="false" />

Any idea what can i do? 9 patch doesnt work for me, i dont know why, i dont understand that tool.

Hope anybody can help

like image 497
user3507915 Avatar asked May 17 '15 18:05

user3507915


2 Answers

Change this preference to true:

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

It will keep your splash aspect ratio, and make the splash image fill your screen without being stretched. Think of it as the equivalent of css style background-size: cover;

like image 157
Kristfal Avatar answered Nov 16 '22 21:11

Kristfal


To cover the patch-9 logo in all android versions, i had to do:

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

and disable the MaintainAspectRatio value:

<!-- <preference name="SplashMaintainAspectRatio" value="true" /> -->
like image 31
metamagikum Avatar answered Nov 16 '22 21:11

metamagikum