There are Button and two styles. Depending on the action, it is necessary to change the styles programmatically. I can not find a solution, is it possible?

The difference in styles is minimal:

<style name="AddClientWeatherButton" parent="Base.Widget.AppCompat.Button"> </style> <style name="AddClientWeatherButtonRed" parent="AddClientWeatherButton"> <item name="colorButtonNormal">@color/button_weather_toggle_color</item> <item name="android:textColor">@color/white</item> </style> 

Alternatively, you can programmatically change two different attributes from the style. With textColor everything is clear, but how to access colorButtonNormal

    1 answer 1

    View style can not be changed programmatically.
    It is possible, for example, to replace the View with the old style with the new View , having previously generated it.