0
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">  
    <item android:drawable="@drawable/back" />
    <item>
        <shape>
            <solid/>
            <stroke 
                android:width="1dip" 
                android:color="#228886" />
            <corners android:radius="5dip"/>
            <padding 
                android:left="0dip" 
                android:top="0dip" 
                android:right="0dip" 
                android:bottom="0dip" />
        </shape>
    </item> 
</layer-list> 

I have the xml like this how can I do it programatically?

JJD
  • 50,076
  • 60
  • 203
  • 339
Goofy
  • 6,098
  • 17
  • 90
  • 156

1 Answers1

0

use LayerDrawable Class. In The constructure you can provide a array of Drawable. Pass there a Drawable and a ShapeDrawable

I haven't tried it though, but I think it should work

stinepike
  • 54,068
  • 14
  • 92
  • 112
  • 1
    hey i found this http://stackoverflow.com/questions/7150593/android-how-to-define-shapedrawables-programmatically is this similar to what you are telling about – Goofy Apr 22 '13 at 05:55