简体   繁体   中英

Stopping Splash Screen to go under the navigation bar

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>

Found one solution

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

to

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

Your @drawable/splash should 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>

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM