title: Creating ring shape in Android code
body: <p>I have the following shape XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;shape xmlns:a="http://schemas.android.com/apk/res/android"
         a:shape="ring"
         a:innerRadiusRatio="3"
         a:thicknessRatio="8"
         a:useLevel="false"&gt;
  
      &lt;!-- some other stuff goes here --&gt;
  
      &lt;/gradient&gt;
  &lt;/shape&gt;
  </code></pre>
  
  <p>I would like to use code instead to create this shape, since some things need to be calculated on the fly before I do it, so static pre-defined layout doesn't cut it.</p>
  
  <p>I'm new to Android and can't quite figure out how XML translates to code, and there's no RingShape class inheriting from Shape.</p>
  
  <p>In addition to answering just this question, if there's a guide somewhere that details relation between XML and Java code and how XML gets processed in order to end up on the screen I would appreciate a link too. Thanks.</p>