Problem displaying ShapeDrawable in an ImageView
<p>I am writing an app which will create drawable shapes and add them to other drawables. (Think Tetris pieces onto a Tetris board.) As a test, I want to have a particular shape appear when my activity is loaded, but I cannot get a Drawable to appear in the ImageView I created. Could anyone explain why the following code isn't working?</p>

<p>Activity code:</p>

<pre><code>public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    ImageView mImg = (ImageView) findViewById(R.id.img);

    ShapeDrawable sD = new ShapeDrawable(new RectShape());
    sD.setBounds(1,1,10,10);
    sD.getPaint().setColor(Color.BLUE);

    mImg.setImageDrawable(sD);
}
</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;ImageView
        android:id="@+id/img"
        android:layout_width="320px"
        android:layout_height="206px"
        /&gt;
    &lt;TextView
        android:id="@+id/debug"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        /&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>Note: I have been able to make static resources from the 'drawable' folder appear in this ImageView, just not Drawables I have created in the code.</p>
