Toolbar behind status bar

I had a problem with toolbar and status bar. I change the app styles to AppCompat. My styles are:

for values/styles.xml

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

        <item name="colorPrimary">@color/color_primario_500</item>
        <item name="colorPrimaryDark">@color/color_primario_500</item>
        <item name="android:windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>

</style>

for values-v21/styles.xml:

<style name="AppTheme" parent="AppTheme.BaseGps">
        <item name="android:windowContentTransitions">true</item>
        <item name="android:windowAllowEnterTransitionOverlap">true</item>
        <item name="android:windowAllowReturnTransitionOverlap">true</item>
        <item name="android:windowSharedElementEnterTransition">@android:transition/move</item>
        <item name="android:windowSharedElementExitTransition">@android:transition/move</item>
        <item name="android:windowTranslucentStatus">true</item>
        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
        <item name="windowActionModeOverlay">true</item>
        <item name="android:statusBarColor">@android:color/transparent</item>

My problem is that half the toolbar appears behind status bar. In the next image you can see what happens.enter image description here

Any ideas? Thanks in advance!!

Upvotes: 3

Views: 3599

Answers (2)

user4941227
user4941227

Reputation:

I don't like these answers. Just because with Material design a Navigation Drawer should overlap the toolbar and have a translucent status bar so long as the API level supports it.

If you want the toolbar to fit properly and have a translucent status bar then you just need these items in your style.

    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
    <item name="android:windowTranslucentStatus">true</item>

Upvotes: 1

The solution is apply the item

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

in the styles.

Upvotes: 3

Related Questions