开发者

Using Shape at runtime in android

开发者 https://www.devze.com 2023-04-04 21:25 出处:网络
I want to do follwing thing from JAVA code . How can i do it ? <shape xmlns:android=\"http://schemas.android.com/apk/res/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

精彩评论

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