I am new to android development and currently making a calculator app. In it, my activity has number of buttons on which I apply the same style. The structure of code is something like as below
layout.xml
<LinearLayout>
<Button
android:text="Button 1"
style="@style/styleName"
>
<Button
android:text="Button 2"
style="@style/styleName"
>
<Button
android:text="Button 3"
style="@style/styleName"
>
</LinearLayout>
style.xml
<resources>
<style name="styleName">
<item name="attribute1">attribute1Value</item>
<item name="attribute2">attribute2Value</item>
<item name="attribute3">attribute3Value</item>
<item name="android:background">BackgroundValue</item>
</style>
</resources>
Now I want to provide a feature to user in which when he/she selects a particular theme from the setting, the background of all buttons will change. This can be achieved if I can change the value of background color in styleName. I am not sure how to achieve this. I look around the web and didn't find any satisfying answer for achieving the same.