2016-08-13 64 views
1

我得到一個png圖像作爲透明顏色,我想在一個ImageView中使用一個白色的android應用程序。 You can check that the image has a transparency colorandroid ImageView不顯示透明度

我添加圖片到每個文件夾(可拉伸-MDPI,抽拉-LDPI ..) 和鏈接與所述圖像的ImageView的。 而不是獲得透明度的顏色,我得到了一個白色的如下所示 The result 藍色屏幕是一個帶背景的RelativeLayout。 這裏的XML代碼:

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_above="@+id/barre_puissance" 
    android:layout_toRightOf="@+id/barre_angle" 
    android:layout_marginLeft="10dp" 
    android:layout_marginBottom="10dp" 
    android:background="@drawable/bg_mr"> 
    <ImageView 
     android:id="@+id/imageView2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/ic_mr_projectile" 
     android:layout_centerInParent="true" 
    /> 
</RelativeLayout> 
+0

圖片右下角有一個黃色警示三角形。那來自哪裏? –

+0

它說「圖像上缺少contentDescription屬性」 – Mouley

+0

我的意思是,你的佈局中有什麼可繪製的三角形? –

回答

0

Android的XML支持與PNG文件透明度,使問題與你的形象。 確保你的PNG圖像文件包含透明度。

+0

對(y),這是圖片,我用另一個替換它,工作正常(y)感謝評論 – Mouley