To change the color of a theme at runtime,
UPDATE
when you apply a theme and want to change color than
EX:
activity.setTheme(R.style.green); <style name="green"> <item name="main_background">@drawable/background_green</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="button_light">@color/button_light</item> </style>
The theme color cannot be changed at runtime for a particular theme .
Create your own style and change these styles when you want to change the color in the application.
source share