I want to make background of a
Make the color have 80% in the alpha channel, for example for red use
<TextView ... android:background="#CCFF0000" />
In the example,
CC is the hex number for
255 * 0.8 = 204. Note that the first two hex digits are for the alpha channel. The format is
AA is the alpha channel,
RR is the red channel,
GG is the green channel and
BB is the blue channel.
I'm assuming that 20% transparent means 80% opaque. If you meant the other way, instead of
33 which is the hex for
255 * 0.2 = 51.
In order to calculate the proper value for an alpha transparency value you can follow this procedure:
2^8=256), meaning the range goes from 0 to 255.
255 * 0.8 = 204. Round to the nearest integer if needed.
FF0000, you will have
You can take a look at the Android documentation for colors