I have a custom component called CircleView
, and I want to change a custom attribute called fillColor
defined in attrs.xml
:
<declare-styleable name="CircleView">
<attr name="radius" format="integer" />
<attr name="fillColor" format="color" />
</declare-styleable>
I have set it initially in my layout XML, which currently looks like this (namespace circleview
is defined as xmlns:circleview="http://schemas.android.com/apk/res-auto"
; it works fine when I define it in the XML, so this shouldn't be an issue):
<com.mz496.toolkit.CircleView
...
circleview:fillColor="#33ffffff"/>
I can get the fillColor
attribute just fine in my CircleView
, which extends View
, but I don't know how to set its value.
I've investigated things like setBackgroundColor
and looked for other "set" methods, but I couldn't find any. I imagined a method like
circle.setAttribute(R.styleable.CircleView_fillColor, "#33ff0000")