2

I tried so many things to change the navbar colour such as

Android lollipop change navigation bar color

android change navigation bar color

How to change system navigation bar color

Nothing works

I added the item to styles.xml - using Android 8.1

<item name="android:navigationBarColor">@color/theme_color</item>

Anyone knows what is the best way to do this in Xamarin.Android

UPDATE: I tried the following code in my style file

  <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowNoTitle">true</item>
    <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
  </style>

  <style name="DrawerArrowStyle" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="color">@color/red</item>
  </style>

  <style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="android:windowFullscreen">true</item>
    <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
  </style>
Ali
  • 2,702
  • 3
  • 32
  • 54

2 Answers2

1

While fixing another issue I had to change and minimum API level to Lollipop and noticed that <itemname="android:navigationBarColor">@color/theme_color</item> started working when minimum API level is set to Lollipop.

So I think for some reason Xamarin requires to use use Minimum API version Lollipop for this to work

Ali
  • 2,702
  • 3
  • 32
  • 54
0

This works for me.

You need to create a new style for drawer toggle like this:

<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
    <item name="color">@color/white_color</item>
</style>

And add this to your preferable style.

<style name="NoActionbarTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/primary</item>
    <item name="colorPrimaryDark">@color/primary_dark</item>
    <item name="colorAccent">@color/primary</item>
    <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
</style>

And finally use NoActionbarTheme theme in manifest file within your Activity.

Hope it will help you.

Vishal Chhodwani
  • 2,567
  • 5
  • 27
  • 40