Adding transparency programmatically using a android color resource -


this question has answer here:

there color in colors.xml without transparency. know can add transparency colors.xml #cc666666. need add transparency programatically.

colors.xml

<?xml version="1.0" encoding="utf-8"?> <resources>     <color name="list_section">#666666</color> </resource> 

in activity:

int color = getresources().getcolor(r.color.list_section); // put transparency here myview.setbackgroundcolor(color); 

guess bitwise or work.

int transparentcolor = 0xcc000000 | color; myview.setbackgroundcolor(transparentcolor); 

Comments