.net maui fully custom splash screen

Haider Ali Faizi 100 Reputation points
2023-09-22T18:15:18.9866667+00:00

I am working on . net maui splash screen but there are android 12 and later issues. So I can not set splash screen like make image like previous android versions. But I want and set it image that has contents on all screen. I have seen many splash screens on modern apps and which wants to do this. They use that technology that first they reduce splash screen time and then, show him new custom splash screen that are custom page instead of splash screen to reduce this issues. How can I do it if i want to show full customize splash screen. Please give me full answer. Apps like Screenshot_2023-09-22-23-07-10-957_com.techlogix.mobilinkcustomer

Screenshot_2023-09-22-23-13-31-712_com.devsense.symbolab

Developer technologies | .NET | .NET MAUI
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2023-09-25T02:17:54.3366667+00:00

    Hello,

    Can you tell me how to reduce custom or default splash screen time?

    No, you cannot reduce custom or defalut splash screen time, From the android 12, the android will use the SplashScreen Api to show the splash screen. It only customizes these parts: icon, window background, exit animation.

    However, here is a workaround to make the default splash screen to transparent.

    You can do this by create a custom style in the /Platforms/Android/Resources/values folder. Firstly, create a xml file that called styles.xml and add custom style in it. I add

    <?xml version="1.0" encoding="utf-8" ?>
    <resources>
       <style name="MainTheme" parent="Maui.MainTheme.NoActionBar">
            <item name="android:windowIsTranslucent">true</item>
        </style>
    </resources>
    

    Then, replace theme from Theme = "@style/Maui.SplashTheme" to Theme = "@style/MainTheme" in the MainActivity.cs like following code.

    [Activity(Theme = "@style/MainTheme", MainLauncher = true...]
    public class MainActivity : MauiAppCompatActivity
    {
    }
    

    Best Regards,

    Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Krew Noah 500 Reputation points
    2023-09-23T10:14:20.2433333+00:00

    To implement a fully customizable splash screen in .NET MAUI for Android 12 and later, you can reduce the actual splash screen's display time and quickly navigate to a custom page that mimics a splash screen. Here’s a brief step-by-step guide:

    1. Create a Custom Page:
      • Create a new Page in your .NET MAUI project.
      • Design this Page with your custom splash screen content.
    2. Navigate to Custom Page:
      • In your App.xaml.cs or App.cs, navigate to the custom splash screen Page first.
      • For example:
             var newWindow = new NavigationPage(new CustomSplashScreenPage());
             MainApplication.Current.MainPage = newWindow;
        
    3. Navigate to Main Page:
      • After a short delay, navigate from your custom splash screen Page to the actual main Page of your application.
      • You can use await Task.Delay(TimeSpan.FromSeconds(2)); to create a delay.
      • For example, inside your CustomSplashScreenPage:
             protected override async void OnAppearing()
             {
                base.OnAppearing();
                await Task.Delay(TimeSpan.FromSeconds(2));
                await Navigation.PushAsync(new MainPage());
             }
        

    This way, your app will quickly navigate from the system splash screen to your custom splash screen Page, which can be fully customized and then to your main application Page.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.