Stopping Splash Screen to go under the navigation

2019-05-28 16:29发布

问题:

I would like to use this splash screen but it keep going under the navigation bar.

Splash img

How can I force it to fit on the screen while keeping the navigation bar?

   <style name="splashScreenTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar.Fullscreen">

    <item name="android:windowBackground">@drawable/splash</item>

</style>

回答1:

Found one solution

 <item name="android:windowBackground">@drawable/splash</item>

to

 <item name="android:background">@drawable/splash</item>    


回答2:

Add this to the xml file of your splash screen activity.

<FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:src="@drawable/splash"/>
    </FrameLayout>


回答3:

Your @drawable/splashshould look something like this:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

<item
    android:drawable="@color/black"/>

<item>
    <bitmap
        android:gravity="center"
        android:src="@drawable/your_image" />
</item>