Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
487 views
in Technique[技术] by (71.8m points)

android - 如何在Android上使背景20%透明(How to make a background 20% transparent on Android)

我如何使Textview的背景大约20%透明(不完全透明),背景中是否有颜色(即白色)?

  ask by Adham translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Use the below code for black:

(将以下代码用于黑色:)

<color name="black">#000000</color>

Now if I want to use opacity then you can use the below code:

(现在,如果我要使用不透明度,则可以使用以下代码:)

 <color name="black">#99000000</color> <!-- 99 is for alpha and others pairs zero's are for R G B -->

And below for opacity code: and all opacity level here

(以下是不透明度代码:以及此处的所有不透明度级别)

Hex Opacity Values (十六进制不透明度值)

100% — FF
95% — F2
90% — E6
85% — D9
80% — CC
75% — BF
70% — B3
65% — A6
60% — 99
55% — 8C
50% — 80
45% — 73
40% — 66
35% — 59
30% — 4D
25% — 40
20% — 33
15% — 26
10% — 1A
5% — 0D
0% — 00

If you always to forget what code for transparency then you must have to see below link and no worry about to remember anything regarding transparent code :-

(如果您始终忘记透明的代码,则必须查看以下链接,而不必担心记住任何有关透明代码的内容:)

https://github.com/duggu-hcd/TransparentColorCode

(https://github.com/duggu-hcd/TransparentColorCode)

textviewHeader.setTextColor(Color.parseColor(ColorTransparentUtils.transparentColor10(R.color.border_color)));

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...