'How to change menu icon color in androidx toolbar?
I get a layout with an androidx.appcompat.widget.Toolbar
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
android:background="#fff"
tools:context=".Activity.Home">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:layout_constraintTop_toTopOf="parent"
android:backgroundTint="#4862ed"
app:titleTextColor="#ffff"/>
</androidx.constraintlayout.widget.ConstraintLayout>
So I want to change the color of the three-dots menu icon set in the Toolbar, but I didn't find any solution which works correctly.
I tried to defined a new style, set from the activity or change it inside the xml declaration but nothing works.
Someone could help me?
Solution 1:[1]
If you use MaterialToolBar you can use this code in the Activity:
MaterialToolBarId.menu.findItem(R.id.yourItemId).icon.setTint(resources.getColor(R.color.yourColor))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
