2

I want to create a new Activity, with black system navigationbar color, like this: enter image description here

Manifest:

<activity
    android:name=".activity.MyActivity"
    android:exported="false"
    android:theme="@style/AppTheme.NoActionBar" />

styles.xml:

<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="android:navigationBarColor">@color/colorBlack</item>
    <item name="android:windowTranslucentNavigation">false</item>
</style>

And the result: enter image description here

I also tried setting the color in the Activity with window.navigationBarColor = getColor(R.color.colorBlack), but it's not working...

What sould I do?

CookieMonster
  • 566
  • 2
  • 6
  • 19

1 Answers1

1

You can try using sth like this:

<style name="AppTheme" parent="Theme.AppCompat">
    <item name="android:navigationBarColor">@color/my_color</item>
</style>

android:navigationBarColor should do the trick.

Here you have a thread regarding this topic: How to change system navigation bar color

mmBs
  • 8,421
  • 6
  • 38
  • 46
  • I used android:navigationBarColor before, as you can see the example... Using parent="Theme.AppCompat.Light.DarkActionBar" makes it impossible to change the navigationbar color? Why? – CookieMonster Aug 21 '22 at 11:33
  • For the Light theme there is a default value of `navigationBarColor` set to `@android:color/white` You can explore source code in Android Studio ;) – mmBs Aug 21 '22 at 11:47