-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Splash Screen is squashed on Android #163
Comments
Can confirm this, we are experiencing the same issue. On iOS it seems to work fine. |
It looks like adding "--fit contain" in the cordova-res command get rid of this issue. Because the default resizing method is --fit cover. |
@Amatewasu I've tried this, but it gives a square squeezed splash screen. |
Finally, I also have the same issue and I don't know how to get rid of it. |
Can confirm that I am also struggling with the same issue for Android.
|
Seems like adding
Also, here is a list of scale types to pick from. |
I was having the same problem, and adding this to config.xml fixed it:
(I've only tested on my Android phone, so can't say for sure if it works as intended in all cases) |
@talhaazhar when I use this option I still briefly see the stretched splashscreen before it shows correctly. Did you have the same? |
@basvdijk I had to settle for diving into the native side and creating a 9-Patch File for Splash Screens. Honestly worth spending the time to create one and never having to worry about it if you have already made the switch from Cordova to Capacitor. I found |
The problem, as far as I can see it, is that the splash screen is rendered with a resolution that does not include the bottom navigation bar. The default settings hide the bottom navigation bar which leaves us with a stretched splash screen. After a night of trial and error I found a combination of settings that keeps a margin on the bottom of the screen (so the splash screen doesn't stretch) and fills it with a color. You can generate the images as normal: cordova-res android --skip-config --copy Next modify two files: capacitor.config.json should contain this (replace backgroundColor with something that suits your design):
android\app\src\main\res\values\styles.xml change:
to:
Run Don't be fooled by the emulator, it doesn't show it correctly. Test it on a real device by exporting and installing the apk. credits to this SO post that got me (finally) in the right direction: https://stackoverflow.com/a/68858732 |
@talhaazhar thanks for linking the 9-patch article. At the end it mentions changing |
@dminkovsky the tutorial is using an older version of Capacitor. I am assuming that you are using Capacitor 2+? |
@talhaazhar thanks a lot for the reply. Yep, I am on v2 still. So it's just a naming convention? I thought this might be the case, but I had a few blocking issues that prevented me from just trying it out. Thanks again for this lead. Using the 9 patch definitely seems like the better approach. |
I have same issue with ionic5/6 and capacitor3. but this solution is works perfectly: https://stackoverflow.com/a/69659719/2059039 thanks @holygekko |
The issue I had was with in capacitor.config.js Eventually I found that androidScaleType doesn't work if you've set useDialog to true. Once I changed my config to the following, everything worked fine.
|
All went belly up with Capacitor 4. Using 9 patch images keeps the aspect ratio in portrait mode, but the splash screen is still squashed in landscape mode, why is that? |
Closing as this isn't an issue with the |
Whoever stambles upon on this issue, please see https://stackoverflow.com/questions/66285483/ionic-capacitor-android-splash-screen-responsiveness . |
My splash.png resource has the correct resolution of 2732x2732, and yet when I run cordova-res and test the app on my phone it is clearly squashed... Is there something I am missing, because I have not read about anyone with this problem.
Original:
Squashed:
The text was updated successfully, but these errors were encountered: