Hello.
I have built a Ionic v4 capacitor app. Everything fine, but we noticed a strange behavior with different devices, both in the class of xxhdpi (Android).
This is how it does appear in a Google Pixel 2 (5 inches, 1080x1920)
I tried to use a 9-patch and result was even worse, no matter what. I tried as well to increase height of this picture to 2400, but then i had the opposite issue with a smaller screen. I even tried to edit the native part of the app, editing any xml which had a reference to splsh.png, with no result other than make it even worse (mostly fullscreen and deformed logo). How can i preserve splash’s aspect ratio?
Same issue, with a brand new Capacitor 2+ project. Running it on a Pixel 2 looks fine. Running it on a Pixel 4 is stretched. Again, this is a stock project, no changes. Just what a plain “cap create” builds.
Hi this worked well,
but somehow for 1 second the splashscreen is streched for 1 second and then it crops the image to the right aspect ratio. Anyone facing the same issue?
You might try my method by moving to a vector for your splash screen. There is a builtin tool in android studio to convert svg to vector but elements wont convert.
This worked for me; It’s just a hack before a fix is found;
Basically when android:windowNoTitle = false ; it will show title at the top of the splash screen. For me i just had to change it’s color to white to hide it;
<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item> // show title bar
<item name="android:background">@null</item>
<item name="android:textColorPrimary">@android:color/white</item> //change title text to white or color of your splashscreen to ignore it;
</style>
<style name="AppTheme.NoActionBarLaunch" parent="AppTheme.NoActionBar">
<item name="android:background">@drawable/splash</item>
<item name="android:windowNoTitle">false</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowIsTranslucent">false</item> // disable this otherwise your app delays to launch
</style>