How to eliminate the android white screen on startup?

Stesvis 1,041 Reputation points
2021-03-15T17:08:21.43+00:00

As you all know, in android we often see a white screen between the splash screen and the first loaded app page (MainPage).
I've tried to create a SplashActivity as explained here
https://learn.microsoft.com/en-ca/xamarin/android/user-interface/splash-screen

But it doesn't really work, even if i simulate a longer delay.

So i ran several tests and this is what i found:

  • When my MainPage has a simple xaml structure, i see no white screen
  • When my MainPage content starts to become more complex, I see the white screen
  • The white screen depends on the complexity of the xaml code and it doesn't matter how much code you have in the ViewModel

In fact,

  • I created a TestPage with just one label in xaml and no code in the ViewModel and i did not see the white screen
  • I copied the xaml code from my MainPage to TestPage and still no code in the TestViewModel (so no bindings), and i did see the white screen

So basically, even with no api calls, no code executing in the ViewModel, i see the white screen if the xaml contains a bunch of elements.

Like I said, creating a dedicated SplashActivity did not help.
Is there a solution?

Thanks

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,302 questions
{count} votes