Create 2 Activities in your Solution. SplashScreen.cs and MainActitivity.cs
The SplashScreen.cs is set as the Launcher and just calls the MainActitivty.cs.
[Activity(
Label = "Baha'i App",
Icon = "@drawable/icon",
Theme = "@style/Theme.Splash",
MainLauncher = true,
NoHistory = true,
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class SplashScreen : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
var intent = new Intent(this, typeof (MainActivity));
StartActivity(intent);
}
}
And the MainActivity....
[Activity(
MainLauncher = false ,
Label = "UDS",
Icon = "@drawable/icon",
Theme = "@style/AppTheme",
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation
)]
public class MainActivity : FormsApplicationActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new UDS.UI.App());
}
}
Then you just need a pretty Splash Screen, so add a MySplash.xml under the Resources/values in the Android project.
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="Theme.Splash" parent="@android:style/Theme.Holo.Light">
<item name="android:windowBackground">@drawable/splashscreen</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowIsFloating">false</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
</resources>
A nice centered "drawable/splash.png" image is made by the file drawable/splashscreen.xml:
<?xml version="1.0" encoding="utf-8" ?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/splash"
android:gravity="center"
android:layout_gravity="center"/>