Search code examples
androidnavigation-drawerandroid-statusbar

How to get systembar tint without overlapping navigation bar in android?


This is what i want. I get this when i disable the statusbar tint, but here status bar gets White background which looks bad and not my requirement.

This is when i enable the statusbar tint, i get the the color specified, but it also overlaps the drawer which i dont want.

This is my current XML, with which i am getting the above output. How can i get the tint effect without overlapping the drawer?

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawerLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="false"
    >        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:fitsSystemWindows="true"
            android:weightSum="1">

            <include
                android:id="@+id/toolbar"
                layout="@layout/toolbar"
               />
        </LinearLayout>
        <com.heinrichreimersoftware.materialdrawer.DrawerView
            android:id="@+id/drawer"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="start"/>
    </android.support.v4.widget.DrawerLayout>

I am using Systembar tint library by ready state softwares to get get transculent status bar on kitkat.


Solution

  • Add this to your theme, this will make your toolbar transparent

    <item name="android:windowBackground">@android:color/transparent</item>
    

    Add this in your colors xml for transparent color

    <color name="transparent">#00000000</color>