-
Notifications
You must be signed in to change notification settings - Fork 1k
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 scaling displays twice #1627
Comments
Unlike Cordova, which first shows a grey empty screen and then the splash screen, Capacitor is able to show the splash image from the beginning. But this "trick" is done by first showing theme with the image and then a native view showing the same image (similar to iOS where it first shows the launch storyboard and then the native image). Would be helpful if you could provide the images you are using, or even better if you can provide a sample project. Meanwhile, if the effect is very annoying for you, you can just remove |
@jcesarmobile I can make a sample project that shows this, but won't be able to do so for a couple of weeks. Can you delete these once you pull it down? |
I got the same issue... first splash is stretched and then shown correctly. Removing |
Having the same issue here wiht a Xiami MI A9SE (5.97-inch touchscreen display with a resolution of 1080x2340 pixels at a pixel density of 432 pixels per inch) In my case Android is using the xxhdpi image that is this one: https://user-images.githubusercontent.com/1107782/65594996-1317ee00-df94-11e9-9d3c-b0aa3dc56e9e.png And this is a GIF of the bad behaviour: As you can see, the first image show is deformed and then have a FOUC to the actual splash screen with |
Any news on how to fix this? I'm currently facing the same issue where the scaling of the initial splash image does not match the androidScaleType: CENTER_CROP I've defined in capacitor.config.json. I also did try to remove the android:theme="@style/AppTheme.NoActionBarLaunch" but then the screen is white at first which looks odd since my splash screen is a red image. I haven't been able to find a way to change the background color since that would also kind of solve the issue at this moment. If anyone knows how to do achieve that, please let me know :) Thanks in advance, |
Same issue |
This issue still is a problem. Hoping this will get fixed :) |
Instead of removing In file
Doing so it is at least a bit less flashy |
Tried to fix it myself but it is quite hard or not even possible since you also would have to respect the |
@peterpeterparker nice work around with the background colour, thank you! |
This becomes big issue if custom splash screen is made i.e. in iOS using lottie animation or something it initially shows that screen, then goes to second one that shows just static splash screen image. Is there a way to leave just one of them for easier and more consistent maintenance? |
As I explained, the way it works is by first showing a theme with the image as background and then a native view showing the same image. This works fine for simple images, but for more complex images you'll have to tweak your theme, or try 9-Patch images. With the OP's provided images, there is no noticeable change from the background image to the native image if using the default FIT_XY, but of course, the image is not properly sized. Sadly the background image can't be sized, I think the people is getting confused because there was a We have removed that file to avoid this kind of confusions. (see #2411). Though, for the OP's provided images, I've found another way of displaying the image with the First in
Then change the theme to also show in full screen
Going to close since we can't really do anything about this since the launch theme has this limitations, if it doesn't work for you try one of the mentioned workarounds:
|
@jcesarmobile Point 4 is not working. The drawable splash screen is always FIT_XY and ignores scaletype. The only way it worked was by replacing android:background with android:src - but then my app crashes from missing images:
|
I am migrating a Cordova app to Capacitor and am experiencing this problem using the exact same splash images the Cordova app renders perfectly. The workaround of adding a background colour works but it's a degradation. I'd love to see Lottie support in Capacitor, that would make this problem disappear and allow us to deliver the best possible user experience. Unfortunately, the Cordova plugin doesn't work: timbru31/cordova-plugin-lottie-splashscreen#188 |
@peterpeterparker This is the only acceptable solution here. It's honestly pathetic that this isn't mentioned in the Capacitor docs, as if it's a perfect replacement for Cordova splash out of the box. @mlynch @mhartington This is not good enough. If you want people to trust Capacitor over Cordova, get these basic things right and make sure the docs are correct please. For anyone else, this is my
My
NOTE: I have autohide set to false as I programatically hide when I'm ready. |
+1 on @daveshirman comment, this is happening on capacitor 2.0 also I find quite frustrating for basic stuffs but essential and we have to effortly fix this issue and yes I used the @peterpeterparker method for now and that is the only visible way of solving the issues. |
Hi,
By the way, i also agree such a simple thing to be so frustating. Maybe not the worst issue on an app but, if all customers have a similarity all around the world is for putting their eyes in such little things - just opening the app - before all the incredible effort behind the scenes. Regards. |
THANKS @Nuajan PS: i also agree such a simple thing to be so frustating. |
Could you share your capacitor.config.json? btw. between the App Start and the Splash Screen and the WebView load there is a quick blank background with a Color that i am not able to change. Do you know where I can change that? |
This is how i do it now: app.component.ts
styles.xml
capacitor.config.json
This was with the native Android start Animations the smoothest way. |
The solution of @Nuajan cause crash on android 8 if you set To solve problem you should :
if (android.os.Build.VERSION.SDK_INT > Build.VERSION_CODES.O) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
} |
This Worked! Thank you |
When the app launches, ,I found twice splash.I fixed:
|
So frustrating, It takes me the whole night to fix this. |
How did you fixed it? |
After spending a lot of time on this I found solution for my app. In AndroidManifest.xml use Cheers, |
Did you released it somewhere? |
@danielehrhardt Coming later this week hopefully. The code is done, I have to document everything and make some examples. |
@aparajita Am I right, that your plugin does not affect the native splash image in the first second when launching the app? One Android problem is the stretched image in the first second on certain devices (Pixel 4, Galaxy S20, ...), so I removed the image in my case and set a background color. After this second, the Capacitor Splashscreen or your Splashscreen take over and shows the image properly. But the initial problem with this stretched image cant be fixed, neither with your plugin, right? |
Until some changes are made to the way things are done in Capacitor, there isn't much you can do on Android. We are actively working on addressing this in Capacitor 3 so that launch screens will seamlessly transition to the plugin splash screen. |
@sergiuturus You want this solution from above: #1627 (comment) I just tried it and also still had a streched image. |
EDIT: I added "androidScaleType": "CENTER_CROP" and I thought the splash image was stretched but it seems like the loading spinner is not being centered. Here are 2 screenshots from 2 apps: capacitor (not centered) and cordova. https://imgur.com/ZuH8Y90 Any idea why this is happening? |
@aparajita Did you/the capacitor team already find a solution for the initial stretched splashscreen issue to be release with capacitor 3? |
can you tell me solution for this? |
please give me some refrences |
Thanks brother <3 |
Same issue. For some reason I couldn't figure out how to hide the splash screen from the code, but by tweaking a few backgrounds based on the responses here, I got it close enough to what I wanted. Not perfect, just close enough. And yes, this whole thing is completely ridiculous. Literally every person who makes an app on this platform has to go through the splash screen, so how is this even still an issue? How was it ever released in this state in the first place? Everything I've gone through today trying to solve this, and a few other things that should be fundamental, it's finally convinced me to abandon Ionic completely and go check out React Native. I've been using Ionic for years and it's just been one disaster after another with bad documentation, constant refactoring and dependency conflicts, and absolutely garbage support from the Ionic team. Good riddance. |
this resolve my problem. thanks bro! |
How about new drawable?
and use it like this |
Try this on for size in your capacitor config:
IMPORTANT: DO NOT FORGET TO UPDATE This made the issue go away on my side. I suspect there is an issue somewhere in the code that deals with offsets when the screen is fullscreen or immersive. ALSO IMPORTANT: you might want to turn |
tried, same scaling twice |
That really works, great work |
Hi, I use different workaround. I add custom_splash.xml at android drawable resource and edit styles.xml. Capacitor.config.json
styles.xml
custom_splash.xml
This works fine for me. |
Shame and disgrace that AFTER MORE THAN TWO YEARS (sic!) since the bug was reported, it still hasn't been resolved. I would never in my life buy premium service from a company that so blatantly ignores problems in its own most important child. I totally understand why react-native or flutter is considered better and more developers work with it
The above workaround does not work with the barcode scanner plugin which require transparent background. <style name="AppTheme.NoActionBar" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@android:color/white</item>
</style>
<style name="AppTheme.NoActionBarLaunch" parent="AppTheme.NoActionBar"></style> |
@Pacjonek Opensource works the other way round: be grateful for what you got not be thankless for what you didn‘t get. |
This comment has been minimized.
This comment has been minimized.
Hire a professional developer. Let's fix him this and then make a pull request. |
@Pacjonek We actively work on and maintain Capacitor, so I'm not sure what you're talking about. Clearly the workarounds in this issue aren't sufficient for people in here but this is a tricky one to get right. We'll take a look. |
I just want to share the two options I found through this post that, to me, seem to be the better alternatives... @peterpeterparker solution works well! The result is that you get a plain background with the desired color for 1-2 seconds before your splash screen kicks in but still acceptable as it is smooth. @enginkarabel solution works as we expect the plugin to behave! This fixes the bad resizing that squeezes the splash screen for 1-2 seconds but requires a "little" more work (believe me it's pretty easy). UPDATE 2022-02-09The proposed @enginkarabel solution is not working with Android 12. In fact... even with Android 11 and lower it was giving a warning in the console that I had to fall back to @peterpeterparker solution but I don't have the smooth fade-in transition as he does... I assume that this is because he is using the SplashScreen.show method with the |
We also have crashes with Samsung Galaxy S20 / Android 12. Because we only use one icon and one background color, I switched to (in addition to #1627 (comment)): capacitor.config.ts
custom_splash.xml
|
It works, but makes startup very slow, a second delay. Using a background color for now. But hoping for a real solution. |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out. |
Description of the problem:
I followed the instructions to configure splash screen scaling described here: https://capacitor.ionicframework.com/docs/apis/splash-screen/#configuration. When the app launches, Capacitor displays my splash screen scaled incorrectly, then adjusts to the scaling I have in my
capacitor.config.json
file:What I'm expecting is that the splash screen displays once, at the specified scale.
Affected platform
OS of the development machine
Other information:
Capacitor version:
5.0
node version:
10.15.3
npm version:
6.9.0
CocoaPods version:
Steps to reproduce:
As described above.
Link to sample project:
The text was updated successfully, but these errors were encountered: