T
T
terminator-light2019-05-06 21:20:22
Java
terminator-light, 2019-05-06 21:20:22

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

1 answer(s)
Y
Yar Rick, 2019-05-06
@terminator-light

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 question

Ask a Question

731 491 924 answers to any question