and i want to get this attributes i" /> and i want to get this attributes i" /> and i want to get this attributes i"/>

some of the custom attributes not working on android

343 Views Asked by At

I have following custom attributes:

    <attr name="myText" format="string" />
    <attr name="myRadius" format="float" />

and i want to get this attributes in class, so i have following code in view class:

 int[] attrsArray = new int[] {
            R.attr.myText,
            R.attr.myRadius
    };

    TypedArray ta = context.obtainStyledAttributes(attrs, attrsArray, 0, 0);
    try {
       String text = ta.getString(0);
       float radius = ta.getFloat(1,0);

    }finally{ta.recycle();}

myText attribute is ok, i received value of myText but radisu attribute is allways 0.0; why does some custom attributes not working?

0

There are 0 best solutions below