2

I want my status bar to be transparent and match action bar color. But for different activities I have diffenrent color for action bar so I can't use "colorPrimaryDark" for my status bar. How to achive this?

v21\styles.xml

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimaryDark">@android:color/transparent</item>
    <item name="android:statusBarColor">@android:color/transparent</item>
    <item name="android:windowTranslucentStatus">true</item>
</style>
<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
    <item name="android:statusBarColor">@android:color/transparent</item>
</style>

Activities has "android:fitsSystemWindows="false""

This is what I have enter image description here And this is what I want enter image description here

Same for other colors in action bar.

Any help?

Ossir
  • 493
  • 1
  • 8
  • 19

1 Answers1

0

This is the normal behavior - this command is for use cases when you want a picture that can't be stretched out behind the status bar like here.
Solution-

1. In my opinion from the picture just change the status bar color:

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

2. Increase the height of your action bar by 25dp (status bar height).

Community
  • 1
  • 1
Nir Duan
  • 6,164
  • 4
  • 24
  • 38
  • 1. Change status bar color for every activity? 2. I can't increase height in layout file because for defferent screen size status bar height is different – Ossir Aug 15 '16 at 10:29
  • 1. will work fine for all activities because for all activities if you use one theme in your app and if not you can inherit your seems from app seem with the "android:statusBarColor" inside. 2. Also works for all handset devices because it's **dp** (Change size with relation to the device). @Ossir – Nir Duan Aug 15 '16 at 10:38