android - 差异 : android:background and android:src?

标签 android android-layout

<分区>

Possible Duplicate:
What is the difference between src and background of ImageView

android:backgroundandroid:src 有什么区别?他们的工作原理一样吗?

最佳答案

android:background 存在于所有 View 中。顾名思义,这就是背景中的内容。

android:src 存在于 ImageViews 及其子类中。您可以将其视为前景。因为 ImageViewView 的子类,所以您甚至可以为此使用 android:background

  • 如果前景小于背景,则未被前景覆盖的背景部分将可见。
  • 此外,您可以在前景中使用透明度,在这种情况下背景将可见(透明)。

关于android - 差异 : android:background and android:src?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9458774/

相关文章:

Android ActionBarCompat 从一开始就不工作

java - 有没有一种方法可以仅使用 xml 来定义包含一堆图像的 android 可绘制对象?

android - eclipse ADT 图形布局

android - 以编程方式将单选按钮文本添加到按钮顶部

android - 选取框文本在小部件中不起作用

android - 在圆形 ImageView 中显示时图像被拉伸(stretch)

android - 禁止在导航架构组件中将 fragment 添加到后台堆栈

java - Android Studio : Searchview for images, 怎么办?

android - 10 秒后 Android 上 OpenGL ES 的 CPU 使用率大幅增加

android - RecyclerView 与 GridLayoutManager 插入项目错误位置