How do I make the background of a Textview about 20% transparent (not fully transparent), where there is a color in the background (i.e. white)?
How do I make the background of a Textview about 20% transparent (not fully
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Make the color have 80% in the alpha channel. For example, for red use
#CCFF0000:In the example,
CCis the hexadecimal number for255 * 0.8 = 204. Note that the first two hexadecimal digits are for the alpha channel. The format is#AARRGGBB, whereAAis the alpha channel,RRis the red channel,GGis the green channel andBBis the blue channel.I’m assuming that 20% transparent means 80% opaque. If you meant the other way, instead of
CCuse33which is the hexadecimal for255 * 0.2 = 51.In order to calculate the proper value for an alpha transparency value you can follow this procedure:
100-20=80)2^8=256), meaning the range goes from 0 to 255.255 * 0.8 = 204. Round to the nearest integer if needed.0xCC.FF0000, you will haveCCFF0000.You can take a look at the Android documentation for colors.