Custom style - extracting attr color in code - works well since color duration is not #ffffffff
I have defined the attr color, set it in style and I am using the below code to use the value. Everything works fine as the color is different from #ffffffff (as per the code below, for any color defined in the style, the color variable gets the correct value, but for white the color value is -1). It seems like with my code the color value should be less than #ffffffff and I don't understand why.
this is attr definition: <attr name="viewLvActive" format="color"/>
this is a custom style string: <item name="@attr/viewLvActive">#ffffffff</item>
This is the code I am using to get this color value from my theme:
Resources.Theme theme = mCtx.getTheme();
TypedValue styleID = new TypedValue();
if (theme.resolveAttribute(R.attr.viewLvActive, styleID, true))
color=styleID.data;
else
color=-1;
Finally, I can live with the #fffffffe color, but still I would like to know where the error is.
source to share