title: How to get a Bitmap from a drawable defined in a xml?
body: <p>How can I get the bitmap from a xml shape drawable. 
  What am I doing wrong?</p>
  
  <p><strong>shadow.xml</strong></p>
  
  <pre><code>&lt;shape xmlns:android="http://schemas.android.com/apk/res/android"
      android:shape="rectangle" &gt;
  
      &lt;gradient
          android:angle="270.0"
          android:endColor="@android:color/transparent"
          android:startColor="#33000000"
          android:type="linear" /&gt;
  
      &lt;size android:height="7.0dip" /&gt;
  
  &lt;/shape&gt;
  </code></pre>
  
  <p>My method to retrieve the bitmap from drawable:</p>
  
  <pre><code>private Bitmap getBitmap(int id) {
      return BitmapFactory.decodeResource(getContext().getResources(), id);
  }
  </code></pre>
  
  <p>getBitmap() is returning null when the id passed in is the <strong>shadow.xml</strong> drawable id.</p>