MAUI Splash Screen

Mugileeshwaran J S 20 Reputation points
2023-11-15T13:29:16.5233333+00:00

Hi, I need help

Im building a maui application, I need a splash screen as a background image.png which fits to the whole screen, but the default behavior of MAUI be like getting my primary color as my background view and image as Foreground img

Can anyone help me with this one?

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,054 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 70,556 Reputation points Microsoft Vendor
    2023-11-16T05:37:38.0633333+00:00

    Hello,

    For Android 10 and 11, you can use the following code to make the image full full the splash screen.

    1. Delete the old splash image in the Resources/Splash folder.
    2. Put your image in it and set it's build action as MauiSplashScreen
    3. Create a xml file in the Platforms\Android\Resources\drawable\maui_splash.xml
    <?xml version="1.0" encoding="utf-8"?>
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">
    <item>
        <bitmap
            android:src="@drawable/splash" //the splash is your image's name
            android:dither="true"
            android:gravity="fill"/>
    </item>
    </layer-list>
    

    And then, your image will show in the full splash screen.

    For android 12 or later, this is by Google's design, we cannot make the full screen. See this google's doc:Splash Screen

    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.

    0 comments No comments