2016-08-13 63 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