开发者

Using Shape at runtime in android

I want to do follwing thing from JAVA code . How can i do it ?

<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
<stroke a开发者_如何学Pythonndroid:width="5dp" android:color="#FFFFFF" /> 
<solid android:color="#FFFddd"/>
<padding android:left="7dp" android:top="13dp" 
        android:right="7dp" android:bottom="17dp" /> 
<corners android:radius="8dp" /> 


the corresponding java class is the ShapeDrawable()

a good way to find out how xml layouts are defined programmatically is to define the layout first as xml and then inflate it. There you can debug it inside the debugger and look what classes/propertys are set.

great methods for this getChild, getParent, getShapeXXX.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜