title: Defining XML Parent Style of Gradient / Shape / Corners
body: <p>How can I define an easily reusable base shape (or gradient, or corners) in XML?</p>
  
  <p>I have a dozen or so drawable gradients that will be the same other than the start and end colors. I was hoping to define the identical stuff somewhere else and have an XML file for each different gradient that only defined the start and end colors. Is that possible?</p>
  
  <p>This is the base:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;shape xmlns:android="http://schemas.android.com/apk/res/android"
         android:shape="rectangle"&gt;
      &lt;gradient xmlns:android="http://schemas.android.com/apk/res/android"
          android:type="linear" 
          android:angle="270" 
      android:startColor="#e1ffffff"
      android:endColor="#e100ff00"&gt;
  
      &lt;stroke android:width="1dp" 
              android:color="#ff000000" /&gt;
  
      &lt;corners android:radius="4dp" /&gt;
  &lt;/gradient&gt;
  &lt;/shape&gt;
  </code></pre>
  
  <p>Then I wanted to overwrite the startColor and endColor (and maybe the corners radius too or any other property) in each drawable's XML file.</p>
  
  <p>I tried using both parent and styles, but neither of them use any of the properties. For example:</p>
  
  <pre><code>&lt;style name="base_gradient"&gt;
      &lt;item name="android:angle"&gt;270&lt;/item&gt;
      &lt;item name="android:type"&gt;linear&lt;/item&gt;
      &lt;item name="android:startColor"&gt;#e1ffffff&lt;/item&gt;
      &lt;item name="android:endColor"&gt;#e100ff00&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p>And then the drawable looks like:</p>
  
  <pre><code>&lt;gradient style="@style/base_gradient" /&gt;
  </code></pre>
  
  <p>That didn't work. I tried similarly putting the above in its own XML file and then doing this for each drawable:</p>
  
  <pre><code>&lt;gradient parent="@drawable/base_gradient" /&gt;
  </code></pre>
  
  <p>That did not work either.</p>
  
  <p>Is there a way to do this?</p>