Android: how to dynamically change theme attributes at runtime from code

I use AppCompat, my application has dynamic color themes. I want to be able to change the attributes primaryColorand accentColorso that the user interface elements match the theme colors (e.g. progress bars, check boxes, etc.).

I can manually set colors for a large number of views, but it becomes difficult for elements such as check boxes and progress bars, where I do not want to create my own capabilities. Obviously, using static XML also does not work for this.

Does the theme attribute change for the action, possibly from the code?

+4
source share

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


All Articles