Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splash screen #125

Closed
wants to merge 13 commits into from
4 changes: 4 additions & 0 deletions docs/TOC.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@
items:
- name: Customize controls
href: user-interface/handlers/customize.md
- name: Images
items:
- name: Splash screens
href: user-interface/images/splashscreens.md
51 changes: 51 additions & 0 deletions docs/user-interface/images/splashscreens.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: "Splash screens"
description: ".NET Multi-platform App UI (.NET MAUI) splash screens can be displayed on Android and iOS when an app is launched, while the app's initialization process completes."
ms.date: 08/19/2021
---

# Splash screens

<!-- Todo: Move this content into the images doc, once it migrates over? -->

On Android and iOS, .NET Multi-platform App UI (.NET MAUI) apps can display a splash screen while their initialization process completes. The splash screen is displayed immediately when an app is launched, providing immediate feedback to users while app resources are initialized. Once the app is ready for interaction, the splash screen is dismissed.

Splash screens are a composite of an image and a background color. The standard platform image formats are supported, including Scalable Vector Graphics (SVG) files.

> [!TIP]
> The SVG format is the recommended image format for .NET MAUI splash screens.

.NET MAUI splash screens can be added to your app project by dragging an image into the _Resources\Images_ folder of the project, and setting the build action of the image to **MauiSplashScreen** in the **Properties** window. This creates a corresponding entry in your project file:

<!-- Todo: The template currently puts the splash screen in Resources, not Resources\Images -->

```xml
<MauiSplashScreen Include="Resources\Images\splashscreen.svg" />
```

Splash screen files names must be lowercase, start and end with a letter character, and contain only alphanumeric characters or underscores.
davidbritch marked this conversation as resolved.
Show resolved Hide resolved

A background color for your splash screen can also be specified:

```xml
<MauiSplashScreen Include="Resources\Images\splashscreen.svg" Color="#512BD4" />
```

<!-- Valid color values are actually derived from the SKColor struct, rather than Microsoft.Maui.Graphics.Colors. This may change. -->
Color values can be specified in hexadecimal, or as a .NET MAUI color. For example, `Color="Red"` is valid.

At build time, the splash screen image is resized to the correct size for the target platform and device. The splash screen is then added to your app package.

<!-- markdownlint-disable MD025 -->

# [Android](#tab/android)

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 theme in your manifest file.
davidbritch marked this conversation as resolved.
Show resolved Hide resolved

# [iOS](#tab/ios)

On iOS, the splash screen is added to the app package as a storyboard named `MauiSplash.storyboard`, which is set as value of the `UILaunchStoryboardName` key in *Info.plist*. Therefore, your app shouldn't add a `LaunchScreen.storyboard` and you shouldn't set the `UILaunchStoryboardName` key in your **Info.plist** file.
davidbritch marked this conversation as resolved.
Show resolved Hide resolved

---

For more advanced splash screen scenarios, per-platform approaches apply.