I am creating a Xamarin forms application and want to create a splash screen which has the same background as the first screen in my app. I have successfully created a splash screen using a layer-list approach and set the windowbackground in the style.xml file. However, the background image seems to go behind the status bar.
I have tried setting the false property - but it still is going behind the status bar.
I have attached a screenshot of what is happening - you can see that one is starting behind the status bar and one is starting below it.
If I set android:top="25dp" on my items in the layer-list everything loads as expected - but I dont really want to do that.
Here is the code i have so far:
splash.axml (layer-list)
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
android:shape="rectangle">
<gradient
android:angle="44.99999887805831"
android:endColor="#FFCB2758"
android:startColor="#FF41157D"
android:type="linear"/>
</shape>
</item>
<item>
<bitmap
android:gravity="fill_horizontal|fill_vertical"
android:src="@drawable/shades"
android:padding="10dp"/>
</item>
</layer-list>
styles.xml
<style name="Theme.Splash" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:windowBackground">@layout/splash</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
</style>
SplashScreenActivity
[Activity(Label = "DimplexControl", Icon = "@drawable/icon", Theme = "@style/Theme.Splash", NoHistory =true, MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class SplashScreenActivity : Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
StartActivity(typeof(MainActivity));
// Create your application here
}
}
Please help...