3

I'm trying to create splash screen for android application with this article: Splash Screens the Right Way. As article says, I created LayerDrawable with two layers: background bitmap and logo (also bitmap). Logo need to be located at the bottom of screen with indent 32dp, for example. Here my drawable:

<item
    android:drawable="@drawable/splash_image" />

<item
    android:id="@+id/logo"
    android:bottom="@dimen/margin_splash">

    <bitmap
        android:gravity="bottom|center"
        android:src="@drawable/logo_green" />
</item>

I pointed this drawable as android:windowBackground param in my splash activity theme. I also want to have transparent status bar when splash screen is shown on devices where this feature is supported (API >=19), so I created two resource files for different android versions and in values-v19\styles.xml I pointed flag android:windowTranslucentStatus as true. Here my values/styles.xml and values-v19/styles.xml:

values/styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:windowBackground">@drawable/bg_splash</item>
    </style>
</resources>

and
values-v19/styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:windowBackground">@drawable/bg_splash</item>
        <item name="android:windowTranslucentStatus">true</item>
    </style>
</resources>

But on some Android devices with Soft NavigationBar my logo is overlapped by it. Logo overlapping by NavigationBar
I tried to point android:windowTranslucentNavigation flag as false but without success.

Is any way to make Android Soft NavigationBar transparent together with transparent status bar, or I need detect Soft NavigationBar availability in onCreate method of my splash activity and update my LayerDrawable by adding bottom indent for logo to the height of NavigationBar?

Thanks.

ibogolyubskiy
  • 2,271
  • 3
  • 26
  • 52

2 Answers2

0

Did you try this?

<item name="android:navigationBarColor">@android:color/transparent</item> <item name="android:windowTranslucentStatus">false</item> <item name="android:windowTranslucentNavigation">false</item>

Also you can a little bottom padding to your bitmap item in the layer drawable.

albeee
  • 1,452
  • 1
  • 12
  • 20
0

I encountered the same problem and solved this problem by setting the following attributes.

<item name="android:windowDrawsSystemBarBackgrounds">false</item>

This attributes is set to values-v21 directory.