Cordova / Ionic框架(Android) -闪屏不成比例

Cordova / Ionic framework ( Android ) - splash screen is out of ratio

本文关键字:不成比例 Android Ionic 框架 Cordova      更新时间:2023-09-26

我正在制作一个ionic cordova应用程序,我创建了一个PNG 2208x2208px的飞溅屏幕,然后使用:

$ ionic resources

溅屏生成,但问题是在我的手机上,溅屏被拉伸/捣碎,像不成比例。

我的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>

这让我很害怕,因为可能有很多其他的手机,我的飞溅屏也会被拉伸,我猜:/

我不明白为什么溅屏看起来这么糟糕,你知道吗?

我强烈建议你阅读9个补丁启动屏幕。这是谷歌推荐的方式:

您还有一个生成器:http://developer.android.com/tools/help/draw9patch.html