Create the attrs.xml file shown in the image.
<?xml version="1.0" encoding="utf-8"?> <resources> <attr name="customBgColor" format="reference" /> </resources>

customTheme 1
<style name = "customTheme1" parent="Theme.AppCompat.Light.NoActionBar"> <item name="customBgColor">#d3d3d3</item> </style>
customTheme 2
<style name = "customTheme2" parent="Theme.AppCompat.Light.NoActionBar"> <item name="customBgColor">#111111</item> </style>
As an example, set the color in a TextView .
You can use it in the same way in any widget anywhere.
This TextView used in the next step.
<TextView android:id="@+id/txt_rate_us_about" android:layout_width="match_parent" android:layout_height="match_parent" android:text="Rate us on Play Store!" android:textColor="?attr/customBgColor" android:textSize="20dp" />
Want to set a theme dynamically.
public class AboutUsActivity extends Activity { int theme = 1;
For several actions, you set a topic for each of them separately.
source share