Where does the style file that defines the Maui.SplashTheme for Android actually live?

dg2k 1,416 Reputation points
2022-09-28T16:32:14.993+00:00

As start-up default, .NET Maui for Android defines the MainActivity as follows:

[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]  

Which means "@STYLE /Maui.SplashTheme" indicates that the Theme is Maui.SplashTheme presumably defined as a Style in the file styles.xml.

But no such file exists.

Where exactly is the Maui.SplashTheme style that Maui defines for Android?

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

Accepted answer
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 50,126 Reputation points Microsoft External Staff
    2022-09-29T02:27:06.61+00:00

    Hello,

    It is hidden by MAUI to prevent it from being modified.

    You could find the following content from Add a splash screen to a .NET MAUI app project:

    On Android, the splash screen is added to your app package as Resourcs/values/maui_colors.xml and Resources/drawable/maui_splash_image.xml. .NET MAUI apps use the Maui.SplashTheme by default, which ensures that a splash screen will be displayed if present. Therefore, you should not specify a different theme in your manifest file or in your MainActivity class.:

    The source code of Splash theme is here: styles.xml.

    Best Regards,

    Alec Liu.


    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.

    2 people found this answer helpful.

0 additional answers

Sort by: Most 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.