I have two buttons, they are same shape, only color is different
b1.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="10dp" />
<stroke android:width="5px" android:color="#000000" />
<solid
android:color="#ff0000"/>
</shape>
b2.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="10dp" />
<stroke android:width="5px" android:color="#000000" />
<solid
android:color="#00ff00"/>
</shape>
layout.xml
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/b1"
android:text="B1" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/b2"
android:text="B2" />
If I want to create 100 button with different colors, I need create 100 drawable xml.
Can I only create one drawable xml, and then override color or other attributes in layout xml?