I am trying to follow the Material Design guidelines to make an app with an actionbar(toolbar) and a navigation drawer, so that it would look like in Google Apps. The solution I have found is to set "android:windowTranslucentStatus" to true in my theme , as well as keeping "android:fitsSystemWindows" as false , compensating for it with extra padding on my toolbar.
The problem is though, that the final color of the statusbar is too dark. Even if I set the toolbar to the same material color as the G-mail app for example, the statusbar color is darker in my app than in the G-Mail app.
Could somebody please point me in the right direction here? I've heard a lot about some custom ScrimLayout hack , but I would like to stick to Android APIs if possible.
I don't know for which api level you're trying this, but for api>=21 try this:
In your values-v21/styles.xml do the following:
<style name="AppTheme" parent="android:Theme.Material.Light.DarkActionBar">
<item name="android:colorPrimary">@color/toolbarcolor</item>
<item name="android:colorPrimaryDark">@color/navdrawercolor</item>
</style>
sources: Youtube - AndroidDeveloper / from Holo to Material
Edit:
for setting the status bar color in api >=21 you could use:
<item name="android:statusBarColor">@android:color/transparent</item>
and set the fullscreen mode in your onCreate in your activity:
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With