How to make any html color code semi transparent [Android]

一笑奈何 提交于 2019-12-22 04:33:28

问题


I have one Android application were i have one shape and in that i have one solid tag.

I want to make this shape 20% transparent with above color code.
How should i do that?


回答1:


If the color is represented in hexadecimal, like #424242, then adding two more digits in front of this "number" will represent the transparency, ex: #66424242. (66 in this example)
You can play a bit until arrive at desired effect.




回答2:


android:color="#66FF0000" is partially transparent red and if you decreasing the value of 6 as 5,4,3 up to 1 as "#56FF0000" ,"#46FF0000","#36FF0000","#26FF0000", the transparent color will becoming thin and the same way if u increase the first number as "#76FF0000","#86FF0000", like that the transparent color becoming thick.so we can arrange the transparency of color ourself. and it is applicable to all type of colors!!




回答3:


Would something like this work?

android:color="#66FF0000"    // Partially transparent red

Taken from https://stackoverflow.com/a/7689776/1391624




回答4:


I have tried adding two digits to the front of the 'number' e.g. #66424242, this definitely works since I use it on my blog



来源:https://stackoverflow.com/questions/17542775/how-to-make-any-html-color-code-semi-transparent-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!