Corrado's Blog 2.0

Online thoughts of a technology funatic

Xamarin.Android Status bar color not set

Not a very descriptive title, but good for search engines Smile

The problem: You’re using Xamarin.Android.Support.v7.AppCompat in order to have Material Design’s Toolbar available also devices running o pre-Lollipop (v.21) releases.

You added a reference to the library:


Added the style:

<style name="ParentMaterialTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <item name="colorControlHighlight">#1ef1ab</item> <item name="colorButtonNormal">#f955f3</item> <item name="colorControlActivated">#0cf427</item> </style>

Added the entry into AndroidManifest.xml:

<application android:label="_02_StandaloneToolbar" android:theme="@style/MaterialTheme" />

Created the toolbar:

< xmlns:android="" xmlns:app="" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/colorPrimary" android:minHeight="?attr/actionBarSize" android:theme="@style/ToolbarTheme" app:popupTheme="@style/PopupTheme" android:id="@+id/toolbar"> </>

Included into Main.axaml:

<RelativeLayout xmlns:android="" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <include android:layout_width="match_parent" android:layout_height="wrap_content" layout="@layout/toolbar"/> </RelativeLayout>

But when you run it, the status bar doesn’t follow colorPrimaryDark but it remains black Confused smile



Solution: add this line into Activity’s OnCreate method (yes, you have to use code)


And you’re done!


4 Responses to “Xamarin.Android Status bar color not set”

  1. Thanks! It works also with custom color changed from seeSharp.

    Comment by Jan — 25/07/2016 @ 11:27

  2. Thank you very much for your solution. Adding your line in “onCreate” method I solve my unbearable issue relating the property of android:windoTranslucentStatus.
    If translucentStatus is setted to true the status bar is tinted, but in such case the toolbar overlap status bar.
    But if it is setted to false the status bar isn’t tinted.
    So by adding your line (AddFlags in oncreate method) and setting translucentstatus to false I solve my problem!!!

    Comment by TuxJ — 29/09/2016 @ 12:13

  3. thank you very match

    you really saved my day

    Comment by Mustafa — 25/02/2017 @ 18:49

  4. Thanks For Ur Blog Helped Me Alot…..

    Comment by Ali — 04/10/2017 @ 17:09

RSS feed for comments on this post. TrackBack URL

Leave a Response