Android : Toolbar status bar overlapping

16,957

Solution 1

as Virus correctly says, the answer is here: Toolbar overlapping below status bar

Simply add the attribute

android:fitsSystemWindows="true"

into the xml item and it will work fine :)

Solution 2

I guess you are using fitSystemWindows property.

Turn off that.

Solution 3

In order to keep translucent status, you need to have

<item name="android:windowTranslucentStatus">true</item>

Just make the below false

<item name="android:windowDrawsSystemBarBackgrounds">false</item>

and in your parent layout

android:fitsSystemWindows="true"

Solution 4

May be your theme has this

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

comment it out

Share:
16,957
Sushant kunal
Author by

Sushant kunal

Updated on June 14, 2022

Comments

  • Sushant kunal
    Sushant kunal about 2 years

    I am working on creating an app with lollipop toolbar with translucent status bar to have the status bar also tinted. It is working fine with the true property.

    It is just that the toolbar is overlapping with the status bar now which looks messy. What is the option to position the toolbar below the status bar with maintaining the window translucent status?

    Code Snippets :

    <style name="Theme.XXX" parent="Theme.AppCompat">
          <item name="colorPrimary">...</item>
          <item name="colorPrimaryDark">...</item>
          <item name="android:windowTranslucentStatus">true</item>
          <item name="windowActionBar">false</item>
          <item name="colorAccent">...</item>
       </style>
    

    Toolbar code used in activity:

    <android.support.v7.widget.Toolbar
            android:id="@+id/main_toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/XXX"
            android:elevation="5dp"
            android:minHeight="?attr/actionBarSize"
            android:theme="@style/Theme.XXX" />
    

    Thanks in advance.

  • Sushant kunal
    Sushant kunal over 9 years
    Thanks but that did not seem to help. I have the following settings in the theme ........<item name="android:windowTranslucentStatus">true</item> <item name="windowActionBar">false</item>......
  • Rensodarwin
    Rensodarwin almost 9 years
    I would not recommend this because there is some side effects with the toast and because the status bar will actually choose a gray color and I'm guessing devs don't want that if they have color for it already. take a better look in this read
  • Parin Parikh
    Parin Parikh about 7 years
    If i have xaml page than what parameter i have to set?
  • Pepoš IV
    Pepoš IV over 4 years
    Sorry, what question do you mean.