问题:
This question already has an answer here: 这个问题在这里已有答案:
I'm working on implementing a widget transparency option for my app widget although I'm having some trouble getting the hex color values right. 我正在为我的应用程序小部件实现一个小部件透明度选项,尽管我在修复十六进制颜色值时遇到了一些麻烦。 Being completely new to hex color transparency I searched around a bit although I couldn't find a specific answer to my question. 作为十六进制颜色透明度的全新,我搜索了一下,虽然我找不到我的问题的具体答案。
I want to set transparency by hex color so let's say my hex color id "#33b5e5" and I want it to be 50% transparent. 我想用十六进制颜色设置透明度,所以让我说我的十六进制颜色ID“#33b5e5”,我希望它是50%透明。 Then I'll use "#8033b5e5" because 80 is 50%. 然后我会使用“#8033b5e5”,因为80%是50%。
I found a useful chart here: http://www.dtp-aus.com/hexadeci.htm . 我在这里找到了一个有用的图表: http : //www.dtp-aus.com/hexadeci.htm 。 With this data I managed to come up with this: 有了这些数据,我设法得到了这个:
0% = #00
10% = #16
20% = #32
30% = #48
40% = #64
50% = #80
60% = #96
70% = #112
80% = #128
90% = #144
Now the issues start appearing when I get higher than 100 in hex. 现在,当我以十六进制高于100时问题开始出现。 Hex color codes can only be 8 symbols long right? 十六进制颜色代码只能长8个符号吗? For example #11233b5e5 (80%) crashes. 例如#11233b5e5(80%)崩溃。
What can I do to enable me to use the higher numbers aswell? 我能做些什么才能让我使用更高的数字呢?
解决方案:
参考一: https://stackoom.com/question/14VrO/六角透明颜色-复制参考二: https://oldbug.net/q/14VrO/Hex-transparency-in-colors-duplicate
来源:oschina
链接:https://my.oschina.net/u/4428122/blog/4309989