androidnavigationuinavigationbar

Android navigation bar icons color


I tried to color my bottom navigation bar
In some android versions it's look white background with white icons

    protected void updateNavigationBarColor(Window window, boolean isLight) {
    if (window == null) {
        return;
    }

    View decorView = window.getDecorView();
    if (decorView == null) {
        return;
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        window.setNavigationBarColor(Utils.getColor(R.color.navigation_bar_color));//black or white
        WindowInsetsControllerCompat controller = new WindowInsetsControllerCompat(window, decorView);
        controller.setAppearanceLightNavigationBars(isLight);
    } else {
        // Do nothing
    }
}

Nav bar result after code run

The navigation bar background color is exactly what I ask for. but the 3 buttons (icons) are stay in always light


Solution

  • In themes.xml added to my theme

    <item name="android:navigationBarColor">@color/transparent</item>
    <item name="android:windowLightNavigationBar">true</item>