mandev
mandev

Reputation: 257

How to transparent status bar on kitkat with Toolbar and NavigationView

i'm trying to get this beautifull design on my app(running Kitkat) on other activities this code is working :

 public static class AppUtils {

        public static void setTitleBarTint(Activity ac) {

            ac.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            SystemBarTintManager tintManager = new SystemBarTintManager(ac);
            tintManager.setStatusBarTintEnabled(true);
            tintManager.setStatusBarTintDrawable(ac.getResources().getDrawable(R.drawable.kitkat_status_bar));


        }
    }

But on my MainActivity with navigationview and coordinator layout and others, this code is not working and missed the toolbar.

Of course i've already tryied every tutorials like:

http://blog.raffaeu.com/archive/2015/04/11/android-and-the-transparent-status-bar.aspx

or others..., but, nothing is worked !

Styles:

 <!-- Base application theme. -->
    <style name="AppTheme" parent="@style/Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorPrimary">@color/ColorPrimary</item>
        <item name="colorAccent">@color/ColorAccent</item>
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
        <item name="windowActionBarOverlay">true</item>
        <item name="android:windowActionBarOverlay">true</item>
        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
        <item name="android:colorButtonNormal">#FF9800</item>
        <!-- Customize your theme here. -->
    </style>

    <style name="Theme.MyTheme" parent="AppTheme">
    <item name="android:windowTranslucentStatus">true</item>
    <item name="android:windowTranslucentNavigation">true</item>
    </style>

Is there any solution for solve this?

Upvotes: 0

Views: 825

Answers (1)

Prasanth Louis
Prasanth Louis

Reputation: 5056

Add this to your styles.xml file.

<style name="Theme.MyTheme" parent="Theme.MyTheme.Base">
    <item name="android:windowTranslucentStatus">true</item>
    <item name="android:windowTranslucentNavigation">true</item>

Upvotes: 1

Related Questions