title: How to import shape resource(xml) to code?
body: <p>I've been trying to import shape xml to customized View. like this, </p>
  
  <pre><code>&lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"&gt;
  &lt;solid 
    android:color="#f0600000"/&gt;
  &lt;stroke
    android:width="10dp" 
    android:color="#00FF00"/&gt;
  &lt;corners 
    android:radius="15dp" /&gt;
  &lt;padding 
    android:left="10dp"
    android:top="10dp"
    android:right="10dp"
    android:bottom="10dp"
  /&gt;
  </code></pre>
  
  <p></p>
  
  <p>and in my customized view code, I try to call it from my external resources</p>
  
  <pre><code>    private void initTestView(){
      Resources res = this.getResources();
      mDrawable = (ShapeDrawable)res.getDrawable(R.drawable.recshape);
  }
  </code></pre>
  
  <p>but if this ruuning on emulator, it called error because mDrawable should be "GradidentDrawable". but what doesn't make it sense is the upper xml code is only for "ShapeDrawable". 
  I don't understand why it happen, does anybody know why it happen? </p>