Status bar turns white and does not show content behind it Status bar turns white and does not show content behind it android android

Status bar turns white and does not show content behind it


I found the answer in this link:Status Bar Color not changing with Relative Layout as root element

So it turns out we need remove the

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

in styles.xml(v21). And it works just fine for me.


(A little late to the party but it might help someone)

I had the exact same problem. Somehow, some activities were normal while new ones I created were showing white status bar instead of colorPrimaryDark value.

After trying several tips, I noticed that the normal-working activities where all using CoordinatorLayout as the root of the layout, while for the others I had replaced it by regular layouts because I didn't need the features (animation, etc) provided by CoordinatorLayout.

So the solution is to make CoordinatorLayout the root layout, and then inside of it add your former layout root. Here is an example:

<?xml version="1.0" encoding="utf-8"?><android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"  xmlns:app="http://schemas.android.com/apk/res-auto"  android:layout_width="match_parent"  android:layout_height="match_parent"  android:fitsSystemWindows="true">  <LinearLayout    android:layout_width="match_parent"    android:layout_height="match_parent"    android:orientation="vertical">    <android.support.design.widget.AppBarLayout        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:theme="@style/AppTheme.AppBarOverlay">        <android.support.v7.widget.Toolbar            android:id="@+id/toolbar"            android:layout_width="match_parent"            android:layout_height="?attr/actionBarSize"            android:background="?attr/colorPrimary"            app:popupTheme="@style/AppTheme.PopupOverlay" />    </android.support.design.widget.AppBarLayout>    <!-- your activity content here-->  </LinearLayout></android.support.design.widget.CoordinatorLayout>

PLEASE NOTE that without android:fitsSystemWindows="true" this solution doesn't work for me.

Tested on Lollipop and Marshmallow


 <style name="AppTheme.NoActionBar">        <item name="windowActionBar">false</item>        <item name="windowNoTitle">true</item>        <item name="android:windowDrawsSystemBarBackgrounds">true</item>        <item name="android:statusBarColor">@color/colorPrimaryDark</item>    </style

Just Replace this , statusBarColor should be your expected color and not TRANSPARENT