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