androidandroid-navigation-bar

Android NavBar is Black


I am learning android. I wanted to implement navigation bar. For Dark theme navbar color is fine but for light theme the navigation bar is still black I wanted it to be white. As highlighted below. I am unable to change it.

Highlighted region

Theme Code

    <style name="NoAction" parent="Theme.MaterialComponents.DayNight.NoActionBar.Bridge">
        <item name="colorPrimary">#71C51D</item>
        <item name="colorPrimaryVariant">#2D8A05</item>
        <item name="colorOnPrimary">@color/white</item>
        <!-- Secondary brand color. -->
        <item name="colorSecondary">@color/teal_200</item>
        <item name="colorSecondaryVariant">@color/teal_700</item>
        <item name="colorOnSecondary">@color/white</item>
        <!-- Status bar color. -->
        <item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
        <item name="android:navigationBarColor">@color/black</item>
    </style>

Menu Code

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:app="http://schemas.android.com/apk/res-auto"

    xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:title="Inbox"
        android:id="@+id/Indbox_menu_main"
        app:showAsAction="always"
        android:icon="@android:drawable/ic_dialog_email"/>
    <item android:title="Sent Item"
        android:id="@+id/Sent_Item_android"
        android:icon="@android:drawable/ic_menu_send"/>
    <item android:title="Help"
        android:icon="@android:drawable/ic_menu_help"
        android:id="@+id/Help_menu"
        />
</menu>

Solution

  • You can use android:backgroud property to change the background color of the navbar.