I'm Coder
I'm Coder

Reputation: 135

Xamarin forms showing white screen is showing before splash screen

Im developing an application using Xamarin forms for my android and iOS application. Currently when the application is being launched , a white screen is shown before my SplashScreen. How can we remove the white screen and shows directly the splash screen ?

App.xaml.cs

  MainPage = new NavigationPage(new SplashScreen());

MainActivity.cs

{
    [Activity(Label = "testApp", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize )]
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity, ActivityCompat.IOnRequestPermissionsResultCallback
    {
 protected override void OnCreate(Bundle savedInstanceState)
        {
            base.SetTheme(Resource.Style.MainTheme);

            base.OnCreate(savedInstanceState);
}
}

Upvotes: 1

Views: 943

Answers (1)

user2153142
user2153142

Reputation: 794

Android 12 doesn't allow an additional activity to act as a splash screen, so the link above is way out of date. The solution at the following link will enable a splash screen for any Xamarin.Android app. https://github.com/gmck/XamarinBasicSplashScreen.

The following is a link to the official android docs https://developer.android.com/develop/ui/views/launch/splash-screen

Upvotes: 1

Related Questions