Issue with windowTranslucentStatus with AppCompat v22

1.5k Views Asked by At

I have an issue with making my Status Bar transparent respectively translucent. I am using AppCompat v22 Theme. I want to use windowTranslucentStatus for API >=19. I really searched for answers on stackoverflow, but i could not find any solution for my problem. I think the easiest way is to show you my code and screenshots from my smartphone I tested the app with.

<RelativeLayout
           android:id="@+id/activitylayout"
           android:fitsSystemWindows="true"
           android:layout_width="fill_parent"
           android:layout_height="fill_parent">

Above the code for my Activity layout.

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

    <item name="colorPrimary">@color/primary</item>
    <item name="colorPrimaryDark">@color/primary_dark</item>
    <item name="colorAccent">@color/accent</item>
    <item name="drawerArrowStyle">@style/drawerarrowstyle1</item>
    <item name="android:windowTranslucentStatus">true</item>
    <item name="android:fitsSystemWindows">true</item>

My style.xml(v19) code. The problem: My Status Bar has a white background and in the nav drawer it is not even visible.

Screenshot of the Status Bar in Activity Layout

Screenshot of Status Bar in Navigation Drawer

1

There are 1 best solutions below

0
On BEST ANSWER

Three things are help me in the same problem.

  1. Correct layout file. Scrollable View above Appbar.

         <! -- Your Scrollable View -->
        <android.support.v7.widget.RecyclerView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:layout_behavior="@string/appbar_scrolling_view_behavior" />
    
        <android.support.design.widget.AppBarLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
       <android.support.v7.widget.Toolbar
                      ...
                      app:layout_scrollFlags="scroll|enterAlways">
    
            <android.support.design.widget.TabLayout
                      ...
                      app:layout_scrollFlags="scroll|enterAlways">
         </android.support.design.widget.AppBarLayout>
    </android.support.design.widget.CoordinatorLayout>
    
  2. android:fitsSystemWindows="true|false"

  3. Style define:

    <style name="AppTheme.TransparentStatusBar">
        <item name="android:windowTranslucentStatus">true</item>
    </style>
    

exact your problem probably in point 2.