Search code examples
androidandroid-appcompatandroid-statusbar

Android AppCompact material design tint for status bar


I want to achieve the status bar described in the Material Design guidelines where the color should be 20% darker than the Toolbar. I have set the following styles:

Styles.xml

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

Style.xml (v21)

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

But I get complete different layouts than expected.

Emulator 4.4

enter image description here

Emulator 5.0.1

enter image description here

Sony Z3 5.0.1

enter image description here

Is there a proper technique to make the Status Bar 20% trasparent (even by code), send the Toolbar and Drawer on back of the Status bar and avoid the usage of FitSystemWindows on Toolbar which stretch all over my screen?


Solution

  • I think this is what you are looking for: https://github.com/jgilfelt/SystemBarTint

    Note that it does only work from Android 4.4 (KitKat), there is no way to tint the system bar on Android versions before 4.4.