Stopping Splash Screen to go under the navigation bar

夙愿已清 提交于 2019-12-07 17:24:55

问题


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:


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>




回答3:


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>


来源:https://stackoverflow.com/questions/45228013/stopping-splash-screen-to-go-under-the-navigation-bar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!