androidandroid-layoutandroid-6.0-marshmallowandroid-6.0.1-marshmallow

Is it possible to use not only status bar but the footer navigation view also for background image


I have searched everywhere but didn't get any help. I want to use a background image as full screen which will cover status bar and the footer navigation also which having a back button with home button and a task switcher button.

Like below image:

Nexus 5 Home Screen


Solution

  • Transparent navigation bar work for Android 4.4+ (API 19) (just like status bar).

    values/styles.xml

    <style name="FullScreenEffectTheme" parent="Theme.AppCompat.NoActionBar">
        <!-- ... -->
    </style>
    

    values-v19/styles.xml

    <style name="FullScreenEffectTheme">
        <!-- StatusBar -->
        <item name="android:statusBarColor">@android:color/transparent</item>
        <!-- NavigationBar -->
        <item name="android:navigationBarColor">@android:color/transparent</item>
    </style>
    

    In code set flags:

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        getWindow().getDecorView().setSystemUiVisibility(
             View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
             View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
    }
    

    Don't forget to set this style to activity :)

    Then you need to add padding or Space to your layout.

    Important: If you want to have landscape orientation for phones translucent navigation bar cause ugly issue and in this case you should off this feature. I solved it like Tanner Perrien explained here.