2017-09-08 35 views
0

添加到我的背景圖片我想一個透明覆蓋添加到Android的我的背景圖片,像下面我想一個透明覆蓋android系統

enter image description here

我的代碼

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="com.bykar.bykar_provider.WaitingForActivationActivity"> 

    <ImageView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:contentDescription="" 
     android:scaleType="centerCrop" 
     android:src="@drawable/map_bg" 
     tools:ignore="ContentDescription" /> 

    <View 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@color/black" 
     /> 
</RelativeLayout> 
+0

難道我寫的東西錯了?我測試你的代碼,它在我的android studio中工作。所以我發佈了這個答案?我能知道我答案的理由不正確嗎? – Anonymous

回答

2

只需將不透明度添加到背景顏色即可。在這個例子中,如果你想70%的不透明度添加到您的黑顏色,然後改變背景顏色的十六進制代碼#B3000000

如果你想要的HEX透明度代碼列表只檢查this答案

3

背景加入鑑於20%不透明

<View 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="#26000000"/> 

這裏是不透明度值,如果你需要:

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