Answer the question
In order to leave comments, you need to log in
How to change toolbar icon colors when switching theme?
The application has dark and light themes. I wanted the colors of the icons to change when switching them.
I have 2 options here so far:
1) separately store black and white versions of icons, have 2 layouts for the menu (one with black icons, the other with white ones)
2) somehow programmatically change their colors
Answer the question
In order to leave comments, you need to log in
Now I'm sitting on the same thing and I have a third option. I specified android:fillColor="?android:attr/textColor" in the XML of each icon. In a light theme, the text is dark, and in a dark theme, respectively, it is light. The icons will recolor automatically when the theme is changed, I hope. Now I will check.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question