1、requestWindowFeature(Window.FEATURE_NO_TITLE);// 隐藏标题,顶部的系统栏不会被覆盖。注意,要放在setcontentview前面,要不然运行会报错。
// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
// WindowManager.LayoutParams.FLAG_FULLSCREEN);// 设置全屏,顶部的系统栏会被覆盖
activity透明三步走
requestWindowFeature(Window.FEATURE_NO_TITLE);
StatusBarUtils.transportStatus(this, getResources().getColor(R.color.transparent));
this.getSupportActionBar().hide();
对应activity的配置
<activity
android:name=".activity.SimpleAdvertiseDialogActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:taskAffinity=".activity.simpleadvertise"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme = "@style/TranslucentTheme"/>
2、控件名.getBackground().setAlpha(150);//int 在0-255之间值越大,透明度越低
3、 半透明 Button android:background="#e0000000"
透明 Button android:background="#00000000"
#66000000
半透明颜色 前2位是透明度,后6位是颜色。
不透明 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
不透明度16进制值:
<color name="lock_screen_text_shadow_grey_color">#40757575</color>
40表示值,757575表示颜色
不透明度% ——值
100% — FF
99% — FC
98% — FA
97% — F7
96% — F5
95% — F2
94% — F0
93% — ED
92% — EB
91% — E8
90% — E6
89% — E3
88% — E0
87% — DE
86% — DB
85% — D9
84% — D6
83% — D4
82% — D1
81% — CF
80% — CC
79% — C9
78% — C7
77% — C4
76% — C2
75% — BF
74% — BD
73% — BA
72% — B8
71% — B5
70% — B3
69% — B0
68% — AD
67% — AB
66% — A8
65% — A6
64% — A3
63% — A1
62% — 9E
61% — 9C
60% — 99
59% — 96
58% — 94
57% — 91
56% — 8F
55% — 8C
54% — 8A
53% — 87
52% — 85
51% — 82
50% — 80
49% — 7D
48% — 7A
47% — 78
46% — 75
45% — 73
44% — 70
43% — 6E
42% — 6B
41% — 69
40% — 66
39% — 63
38% — 61
37% — 5E
36% — 5C
35% — 59
34% — 57
33% — 54
32% — 52
31% — 4F
30% — 4D
29% — 4A
28% — 47
27% — 45
26% — 42
25% — 40
24% — 3D
23% — 3B
22% — 38
21% — 36
20% — 33
19% — 30
18% — 2E
17% — 2B
16% — 29
15% — 26
14% — 24
13% — 21
12% — 1F
11% — 1C
10% — 1A
9% — 17
8% — 14
7% — 12
6% — 0F
5% — 0D
4% — 0A
3% — 08
2% — 05
1% — 03
0% — 00
Android全屏设置、控件透明度,色值透明对照
最新推荐文章于 2024-07-24 19:40:21 发布