我正在开发一个 ionic cordova 应用程序,我创建了一个 PNG 2208x2208px spalshscreen,然后使用以下方法创建了启动画面:
$ ionic resources
启动画面已生成,但问题出在我的手机上,启动画面被拉伸(stretch)/混合成比例失调。
我的 config.xml 里面有这个:
<preference name="orientation" value="portrait"/>
<preference name="webviewbounce" value="false"/>
<preference name="UIWebViewBounce" value="false"/>
<preference name="DisallowOverscroll" value="true"/>
<preference name="BackupWebStorage" value="none"/>
<preference name="SplashScreen" value="screen"/>
<preference name="SplashScreenDelay" value="3000"/>
<preference name="xwalkVersion" value="14+"/>
<preference name="xwalkCommandLine" value="--disable-pull-to-refresh-effect"/>
<preference name="xwalkMode" value="embedded"/>
<platform name="android">
<icon src="resources/android/icon/drawable-xhdpi-icon.png"/>
<icon src="resources/android/icon/drawable-ldpi-icon.png" density="ldpi"/>
<icon src="resources/android/icon/drawable-mdpi-icon.png" density="mdpi"/>
<icon src="resources/android/icon/drawable-hdpi-icon.png" density="hdpi"/>
<icon src="resources/android/icon/drawable-xhdpi-icon.png" density="xhdpi"/>
<icon src="resources/android/icon/drawable-xxhdpi-icon.png" density="xxhdpi"/>
<icon src="resources/android/icon/drawable-xxxhdpi-icon.png" density="xxxhdpi"/>
<splash src="resources/android/splash/drawable-port-ldpi-screen.png" density="port-ldpi"/>
<splash src="resources/android/splash/drawable-port-mdpi-screen.png" density="port-mdpi"/>
<splash src="resources/android/splash/drawable-port-hdpi-screen.png" density="port-hdpi"/>
<splash src="resources/android/splash/drawable-port-xhdpi-screen.png" density="port-xhdpi"/>
<splash src="resources/android/splash/drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/>
<splash src="resources/android/splash/drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/>
</platform>
这让我感到害怕,因为可能还有大量其他手机也会拉伸(stretch)我的闪屏,我猜 :/
我不明白为什么启动画面看起来这么糟糕,有什么想法吗?
最佳答案
我强烈建议您阅读 9 patch splash screens .这是 Google 推荐的方式:
您还有一个生成器:http://developer.android.com/tools/help/draw9patch.html
关于javascript - Cordova/Ionic 框架 ( Android ) - 启动画面不合比例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32580361/