You can use Layout to do this, like LinearLayout or AbsoluteLayout.
Firstly, create new layout name Splash-layout.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#00ff00"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#0000ff"/>
</LinearLayout>
Then create splashActivity,make mainlauncher=true.
[Activity(MainLauncher = true, Theme = "@style/Theme.AppCompat.Light.NoActionBar", NoHistory = true)]
public class SplashActivity : AppCompatActivity
{
static readonly string TAG = "X:" + typeof (SplashActivity).Name;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
Log.Debug(TAG, "SplashActivity.OnCreate");
// Using Layout (green and blue)
SetContentView(Resource.Layout.splash_layout);
// Using a view, SplashView below, that draws its background (yellow and red)
//SetContentView(new SplashView(this));
Task startupWork = new Task(() => { SimulateStartup(); });
startupWork.Start();
}
// Prevent the back button from canceling the startup process
public override void OnBackPressed() { }
// Simulates background work that happens behind the splash screen
async void SimulateStartup ()
{
Log.Debug(TAG, "Performing some startup work that takes a bit of time.");
await Task.Delay(8000); // Simulate a bit of startup work.
Log.Debug(TAG, "Startup work is finished - starting MainActivity.");
StartActivity(new Intent(Application.Context, typeof (MainActivity)));
}
}