How do I inflate an XML ShapeDrawable and also define its position on screen?
<p>I'm totally confused on drawing shapes I define in an XML file and whether I need a view, canvas or shapedrawaable etc etc!</p>

<p><strong>What I'm Attempting To Achieve</strong></p>

<p>I want to define several BASIC shapes in XML such as a rectangle and circle including their dimensions and colour. I would also like to define their position on screen.</p>

<p><strong>My Code So Far</strong></p>

<p>BasicShapes.java</p>

<pre><code>package com.kerry.basicshapes;

import android.app.Activity;
import android.os.Bundle;

public class BasicShapes extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}
</code></pre>

<p>main.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    &gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>shapes.xml</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;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;
&lt;/shape&gt;
</code></pre>

<p>How do I get the rectangle I've defined in shapes.xml onto the screen? I can't find any examples of what I want to do and can't get my head around the Android documentation. Can I achieve this in main.xml and how do I stipulate the size and position of the XML defined shape?</p>

<p>Many thanks for your help</p>

<p>Kerubu</p>
