0

I wanted to change the color of icons in the bottom app bar. I am using the bottom app bar for the first time so I don't have any prior knowledge of it. The code of the XML file having bottom app bar is below

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".NavigActivity">


    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/colorAccent">
        <com.google.android.material.bottomappbar.BottomAppBar
            android:id="@+id/bottom_app_bar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            app:backgroundTint="@color/colorAccent"
            app:navigationIcon="@drawable/ic_menu_black_24dp"
            app:menu="@menu/menu"
            app:buttonGravity="center_vertical"
            />
        <com.google.android.material.floatingactionbutton.FloatingActionButton
            android:id="@+id/fab"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_add_black_24dp"
            app:layout_anchor="@id/bottom_app_bar"
            android:backgroundTint="@color/colorPrimary"

            app:maxImageSize="35dp"/>

    </androidx.coordinatorlayout.widget.CoordinatorLayout>
    <FrameLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/content_frame"
 />

</RelativeLayout>

The menu file used in this is below

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <item
        android:id="@+id/home"
        android:title="Home"
        android:icon="@drawable/ic_home_black_24dp"
        app:showAsAction="ifRoom"
        />
    <item
        android:id="@+id/my_invoices"
        android:title="Invoices"
        android:icon="@drawable/ic_receipt_black_24dp"
        app:showAsAction="ifRoom"
        />
    <item
        android:id="@+id/notification"
        android:title="Notification"
        android:icon="@drawable/ic_notifications_black_24dp"
        app:showAsAction="ifRoom"
        />


</menu>

I wanted the color o the icon to change to primaryColor but it is not changing..Any help would be appreciated

shantanu srivastava
  • 181
  • 1
  • 2
  • 11

1 Answers1

0

You can try on menu.xml

Find the detail on link. (image)

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="[URL]http://schemas.android.com/apk/res/android[/URL]"
    xmlns:app="[URL]http://schemas.android.com/apk/res-auto[/URL]">
    <item
        android:id="@+id/menu_color_change"
        android:title="Color Plate"
        app:showAsAction="ifRoom"
        android:icon="@drawable/ic_color_plate">
    </item>
    <item
        android:id="@+id/menu_other"
        android:title="Other"
        app:showAsAction="never"
        android:iconTint="@android:color/white"
        android:icon="@drawable/ic_color_plate">
    </item>
</menu>
veronika
  • 1
  • 5