问题
I am trying to set a width and a height for my splash screen in my config.xml.
I am using PhoneGap Build and the PhoneGap version is 3.7.0, and the target is Andoird.
The splash screen always shows up very distorted (i.e. it will always be resized so it fits the entire screen).
The following has no effect:
<gap:splash src="./assets/img/logos/appLogo.png" width='200' height='100' />
And the following does not make the splash screen show at all:
<gap:splash src="./assets/img/logos/appLogo.png" gap:platform="android" width='200' height='100' />
回答1:
You should provide different splashscreens for different screen sizes.
According to the phonegap wiki ( https://github.com/phonegap/phonegap/wiki/App-Splash-Screen-Sizes ) the sizes should be:
LDPI:
Portrait: 200x320px
Landscape: 320x200px
MDPI:
Portrait: 320x480px
Landscape: 480x320px
HDPI:
Portrait: 480x800px
Landscape: 800x480px
XHDPI:
Portrait: 720px1280px
Landscape: 1280x720px
XXHDPI:
Portrait: 960px1600px
Landscape: 1600x960px
XXXHDPI:
Portrait: 1280px1920px
Landscape: 1920x1280px
You can point in your config.xml to the splashscreens you provide, for example:
<gap:splash src="res/screen/splash_ldpi.png" gap:platform="android" gap:qualifier="port-ldpi" />
<gap:splash src="res/screen/splash_mdpi.png" gap:platform="android" gap:qualifier="port-mdpi" />
<gap:splash src="res/screen/splash_hdpi.png" gap:platform="android" gap:qualifier="port-hdpi" />
<gap:splash src="res/screen/splash_xhdpi.png" gap:platform="android" gap:qualifier="port-xhdpi" />
来源:https://stackoverflow.com/questions/33567481/splash-screen-size-in-phonegap-app