开发者

How to use android custom component dynamic attr

开发者 https://www.devze.com 2023-03-29 16:00 出处:网络
I made a custom component, piechart and in the GraphicalView.class, I set this in this class Value=attrs.getAttributeIntValue(null, \"GO\", 80);

I made a custom component, piechart and in the GraphicalView.class, I set this in this class Value=attrs.getAttributeIntValue(null, "GO", 80);

So now, I can add a component by put these code in xml

<view

class="org.piechart.GraphicalView"

android:id="@+id/piechart"

GO="48" />

but in this situation, i have to dynamic modify the piechart value in Activity, i hope i can use

View view1= (View)findViewById(R.id.开发者_JAVA百科piechart); view1.set ????

but i have no idea how to modify the value

i have to use xml to put a component to layout,and i have to dynamic modify the the component value

0

精彩评论

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