What is the difference between src and ImageView background

I am a little puzzled using src or background for ImageView . I know that the former means the content of this ImageView , and the latter means the background of the ImageView . But how to determine which one to use? I do not see the difference.

+56
android background imageview src
Mar 28 '11 at 3:52
source share
3 answers

All views may have a background image.

src to ImageView has additional features:

  • various types of scaling
  • adjustViewBounds to set the boundaries of the image size
  • some conversions like alpha tuning

And also what you can find in the documents .

+60
Mar 28 2018-11-11T00:
source share

If you set the image as the background of your ImageView, then the image will scale to any size than ImageView. In addition, src is the foreground image, and the background is the background image. No matter how important it is.

+15
Mar 28 '11 at 3:59 a.m.
source share
  • when you use android:background , the image will be set according to the ImageView area (depending on the width and height of the ImageView ). It doesn't matter if the image is smaller or larger than ImageView .

  • when you use android:src , then the image will be displayed in its original size. no auto scaling, settings will be performed.

+10
Nov 03 '15 at 11:56
source share



All Articles