Can I make an Android button template?
<p>I have several buttons in my current app.  They are all identical except for their text and a tag.  The main.xml would be a lot nicer if I didn't have to repeat all the button config information for each button.</p>

<p>Is there a way to define a button as template, and then make more using it as a template?</p>

<p>In this example, I have about 10 of the following:</p>

<pre><code> &lt;Button
            android:id="@+id/button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="10dp"
            android:text="Y"
            android:typeface="monospace"
            android:textSize="12pt"
            android:tag="Y"
            android:textColor="@color/button_text"
            android:background="@drawable/grey_blank_48x48"
            android:onClick="onButtonClicked"/&gt;
</code></pre>

<p>It would be nice if I had one, and then 9 of these:</p>

<pre><code> &lt;Button2
            android:text="N"
            android:tag="N"/&gt;
</code></pre>

<p><strong>Resolution</strong></p>

<p>It was pretty much as @Luksprog said:</p>

<pre><code>&lt;style name="ASR33_button" &gt;
    &lt;item name="android:id"&gt;@+id/button&lt;/item&gt;
    &lt;item name="android:layout_width"&gt;wrap_content&lt;/item&gt;
    &lt;item name="android:layout_height"&gt;wrap_content&lt;/item&gt;
    &lt;item name="android:padding"&gt;10dp&lt;/item&gt;
    &lt;item name="android:textColor"&gt;@color/button_text&lt;/item&gt;
    &lt;item name="android:background"&gt;@drawable/grey_blank_48x48&lt;/item&gt;
    &lt;item name="android:onClick"&gt;onButtonClicked&lt;/item&gt;
    &lt;item name="android:typeface"&gt;monospace&lt;/item&gt;
    &lt;item name="android:textSize"&gt;12pt&lt;/item&gt;
&lt;/style&gt;
</code></pre>

<p>with the main.xml having things like this:</p>

<pre><code>   &lt;Button
            style="@style/ASR33_button"
            android:tag="Y"
            android:text="Y"
            /&gt;

   &lt;Button
            style="@style/ASR33_button"
            android:tag="N"
            android:text="N"
            /&gt;
</code></pre>

<p>This carries the day.</p>
