Create a Shape dynamically
问题 I have a shape object defined in XML like below: <shape android:shape="rectangle"> <gradient android:startColor="#333" android:centerColor="#DDD" android:endColor="#333"/> <stroke android:width="1dp" android:color="#FF333333" /> </shape> I want to create an equal object in my code. I created a GradientDrawable as below: gradientDrawable1.setColors(new int[] { 0x333, 0xDDD, 0x333 }); gradientDrawable1.setOrientation(Orientation.TOP_BOTTOM); But I don't know how to create a Stroke(?) and then