Toolbar Does Not Tone MenuItems

I have white icons that I want to use on the toolbar, but they are not tinted to my theme (based on AppCompat.Light ). No matter what color icons I put, they keep that color and don't turn dark gray (like overflow icons and SearchView).

 <android.support.v7.widget.Toolbar 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:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/colorPrimary" app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" app:contentInsetStart="0dp"> 

Here is my topic:

 <style name="Theme.*myapp*" parent="Theme.AppCompat.Light"> <item name="colorPrimary">@color/accent</item> <item name="colorPrimaryDark">@color/accent_dark</item> <item name="colorAccent">@color/accent</item> <item name="windowActionBar">false</item> <item name="android:dialogTheme">@style/*myapp*.Dialog</item> <item name="android:textColorPrimary">#DE000000</item> <item name="android:textColorSecondary">#8A000000</item> </style> 

Is there something I need to do to get the toolbar to tint MenuItems?

+5
source share
2 answers

Try <item name="colorControlNormal">@color/white</item>

+1
source

It looks like Google is hiding something: I tried to add the following two items to my menu. Xml:

 <item android:id="@+id/menu_test2" android:icon="@drawable/i_cccc_mtrl_alpha" android:orderInCategory="10" pressreader:showAsAction="always" /> <item android:id="@+id/menu_test3" android:icon="@drawable/abc_ic_menu_cut_mtrl_alpha" android:orderInCategory="10" pressreader:showAsAction="always" /> 

i_cccc_mtrl_alpha is a copy of abc_ic_menu_cut_mtrl_alpha, abc_ic_menu_cut_mtrl_alpha is from the appcompat package. Thus, abc_ic_menu_cut_mtrl_alpha works fine on both topics (Light and Dark) on all devices, i_cccc_mtrl_alpha is not tinted and is always white ...

0
source

Source: https://habr.com/ru/post/1205479/


All Articles