-2

I use this menu:

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <item
        android:id="@+id/menu_notifications"
        android:orderInCategory="1"
        app:actionLayout="@layout/notification_toolbar"        
        android:visible="false"
        app:showAsAction="always" />

</menu>

Then here you are my action layout:

RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center"
    android:layout_gravity="center"
    android:clickable="true"
    style="@android:style/Widget.ActionButton">

    <com.app.ui.widget.IconView == ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="0dp"
        android:src="@drawable/ic_notifications_tb"
        android:id="@+id/icon"/>

    <FrameLayout
        android:id="@+id/count_layout"
        android:layout_width="12dp"
        android:layout_height="12dp"
        android:layout_marginLeft="11dp"
        android:background="@drawable/circle_red"
        android:visibility="gone"/>

</RelativeLayout>

And I want to update the color of "icon" programmatically. I tried to parse my toolbar but it doesn't work.

Thank you very much guys!

anthony
  • 7,349
  • 8
  • 44
  • 94
  • 1
    Get the View and set the tint on the `IconView` . have u tried anything ? [Like this](https://stackoverflow.com/a/48277482/4168607) ? and to get the View you can use [This](https://stackoverflow.com/questions/34378670/how-to-access-views-insde-the-actionlayout-in-menu). – ADM May 15 '22 at 08:24
  • @ADM: my question is about how can I retrieve this view "icon" from toolbar? – anthony May 15 '22 at 08:50

0 Answers0