Hello,
I've tried different base sizes, but not working. Target android version up-to 13
On Android 12, it's not possible to make image to full screen in splash screen. It is only possible to customize it: icon, window background, exit animation. Please see this google document: Splash screen
However, here is workaround to make the splash screen to transparent, then you can create a splashScreen with Contentpage, add images in the contentpage.
Step 1. Create styles.xml
at Platforms/Android/Resources/values
folder, and add the following code to customize style. And make sure the build action
of styles.xml
is AndroidResource
.
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="MyTheme.Splash" parent ="MainTheme">
<item name="android:windowIsTranslucent">true</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowSplashScreenAnimatedIcon">@android:color/transparent</item>
<item name="android:windowSplashScreenAnimationDuration">0</item>
</style>
</resources>
Step2. Open your MainActivity.cs, change the theme to Theme = "@style/MyTheme.Splash"
.
[Activity(Theme = "@style/MyTheme.Splash", ...)]
public class MainActivity : MauiAppCompatActivity
{
}
Step3, please create a Contentpage called SplashScreen add your image to it. And open the Mainpage after several seconds by Task.Delay()
and Application.Current.MainPage = new MainPage ();
like following code.
protected override async void OnAppearing()
{
base.OnAppearing();
await Task.Delay(1000).ContinueWith(t => {
MainThread.InvokeOnMainThreadAsync(() => {
Application.Current.MainPage = new MainPage ();
});
});
}
Step4 open the App.xaml.cs, change the MainPage to the SplashScreen.
public partial class App : Application
{
public App()
{
InitializeComponent();
MainPage = new SplashScreen();
}
}
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.