Android Drawable question
<p>I am trying to create a drawable in code and change the color based on some criteria. I can get it to work but it doesn't want to let me set the padding on the view. Any help would be appreciated.</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
</code></pre>

<p></p>

<pre><code>&lt;ImageView
    android:id="@+id/icon"
    android:layout_width="50px"
    android:layout_height="fill_parent"
/&gt;

&lt;TextView
    android:id="@+id/label"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:paddingLeft="17px"
    android:textSize="28sp"
/&gt;
</code></pre>

<p></p>

<pre><code>            ImageView icon = (ImageView) row.findViewById(R.id.icon);
        ShapeDrawable mDrawable;

        int x = 0;
        int y = 0;
        int width = 50;
        int height = 50;

        float[] outerR = new float[] { 12, 12, 12, 12, 12, 12, 12, 12 };

        mDrawable = new ShapeDrawable(new RoundRectShape(outerR, null, null));
        mDrawable.setBounds(x, y+height, x + width, y);



        switch(position){

        case 0:
            mDrawable.getPaint().setColor(0xffff0000);      //Red
            break;
        case 1:
            mDrawable.getPaint().setColor(0xffff0000);      //Red
            break;
        case 2:
            mDrawable.getPaint().setColor(0xff00c000);      //Green
            break;
        case 3:
            mDrawable.getPaint().setColor(0xff00c000);      //Green
            break;
        case 4:
            mDrawable.getPaint().setColor(0xff0000ff);      //Blue
            break;
        case 5:
            mDrawable.getPaint().setColor(0xff0000ff);      //Blue
            break;
        case 6:
            mDrawable.getPaint().setColor(0xff696969);      //Gray
            break;
        case 7:
            mDrawable.getPaint().setColor(0xff696969);      //Gray
            break;
        case 8:
            mDrawable.getPaint().setColor(0xffffff00);      //Yellow
            break;
        case 9:
            mDrawable.getPaint().setColor(0xff8b4513);      //Brown
            break;
        case 10:
            mDrawable.getPaint().setColor(0xff8b4513);      //Brown
            break;
        case 11:
            mDrawable.getPaint().setColor(0xff8b4513);      //Brown
            break;
        case 12:
            mDrawable.getPaint().setColor(0xffa020f0);      //Purple
            break;
        case 13:
            mDrawable.getPaint().setColor(0xffff0000);      //Red
            break;
        case 14:
            mDrawable.getPaint().setColor(0xffffd700);      //Gold
            break;
        case 15:
            mDrawable.getPaint().setColor(0xffff6600);      //Orange
            break;
        }

        icon.setBackgroundDrawable(mDrawable);
        icon.setPadding(5, 5, 5, 5);
</code></pre>

<p>If I set the padding in XML it just ignores it. </p>

<p>Thanks, 
Rob</p>
