现在的位置: 首页 > 综合 > 正文

imageView src与background区别

2014年09月05日 ⁄ 综合 ⁄ 共 404字 ⁄ 字号 评论关闭

background 就是背景没错呀 src 指的是 ImageView 要显示的图像

  1.     <ImageView
  2.         android:id="@+id/dummy_left"
  3.         android:layout_width="wrap_content"
  4.         android:layout_height="wrap_content"
  5.         android:background="#0F0"
  6.         android:contentDescription="@string/hello_world"
  7.         android:scaleType="fitStart"
  8.         android:src="@drawable/ic_launcher" />

背景就是在后面的东西,不会前来干扰你前面的 src
当然,同 frank 所述,当 src 有透明效果时,可将背景色显示在 src 中,比如下面的回形针就是透明的,用的是背景的绿色

请输入图片描述

祝好,
斑驳敬上

抱歉!评论已关闭.