Splash Screen using xamarin form.
We will create simple splash screen. please watch video to understand the code
Let begin with android project.
Follow the step as given below:
1. First add icon in your android project in Resource -> Drawable folder.
2. Create xml file with name "splash_background" in Resource -> Drawable folder
3. Copy below code in xml file.
<?xml version="1.0" encoding="utf-8" ?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<color android:color="#FFFFFF"/>
</item>
<item>
<bitmap
android:src="@drawable/splashscreen"
android:tileMode="disabled"
android:gravity="center"/>
</item>
</layer-list>
android:src="@drawable/splashscreen" (splashscreen is the name of the icon)
<color android:color="#FFFFFF"/> set background color.
4. In Resource -> values -> styles.xml , add below code.
<style name="MyTheme.Splash" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@drawable/splash_background</item>
</style>
In MainActivity Class Update the Theme property to "MyTheme.Splash"
[Activity(Label = "SchoolUIDesigns", Icon = "@mipmap/icon", Theme = "@style/MyTheme.Splash", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize )]
Please refer below URL for splash screen for IOS project. As I dont have Mac pc I not able to create demo for it.
https://dev.to/raulmonteroc/setup-a-splash-screen-on-xamarin-forms-4ena
Hope this blog is helpful to you. Please share your feedback in comment section. Thank you for reading.
Comments
Post a Comment