Toolbar behind the status bar
I am having a problem with the toolbar and status bar. I am changing the style of my application to AppCompat. My styles:
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 of the toolbar appears behind the status bar. In the following image, you can see what is happening.
Any ideas? Thanks in advance!
+3
Alejandro Martínez Martínez
source
to share
2 answers
The solution is applied to the item
<item name="android:windowTranslucentStatus">false</item>
in styles.
+3
Alejandro Martínez Martínez
source
to share
I don't like these answers. Simply because when designing materials, the navigation drawer must overlap the toolbar and have a semi-transparent status bar as long as the API level supports it.
If you want the toolbar to be compliant and have a semi-transparent status bar, you just need these elements 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>
+1
user4941227
source
to share