这是我正在使用的图像,我想添加一个红色的透明覆盖层Orignal Image
我想在此图像上添加半透明的叠加层我使用了这段代码,但是我完全隐藏了图像
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#ffcccb"
android:centerColor="#ffcccb"
android:endColor="#ffcccb"
/>
</shape>
<ImageView
android:id="@+id/backgroudImage"
android:layout_width="match_parent"
android:layout_height="254dp"
android:rotation="0"
android:scaleType="fitStart"
android:foreground="@drawable/image_overlay"
android:src="@drawable/backgroud"
/>
如何调整颜色代码如何降低不透明度我想显示我的图像视图,如该图像This is the view i want to get
使用下面的黑色代码:
<color name="black">#000000</color>
现在,如果我想使用不透明度,则可以使用以下代码:
<color name="black">#99000000</color> <!-- 99 is for alpha and others pairs zero's are for R G B -->
以及下面的不透明度代码:以及所有opacity level here
十六进制不透明度值
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
您还可以在属性布局上更改alpha值。您可以写入图像alpha 0.5