Difference: android: background and android: src?

Possible duplicate:
What is the difference between src and ImageView background

What is the difference between android:background and android:src ? Is their job the same?

+6
source share
3 answers

android:background exists for all views. As the name implies, this is what will be in the background.

android:src exists for ImageViews and its subclasses. You can think of it as a foreground. Since ImageView is a subclass of View , you even have android:background .

  • If the foreground is less than the background, a background part that is not covered by the foreground will be visible.
  • In addition, you can use transparency in the foreground, in which case the background will be visible (transparent).
+13
source

You can use the BACKGROUND FOR ALL TYPES. But you can use SRC only for ImageView and ImageButton .....

+1
source

one sets the background, one sets the image. You can use both to set the background for the image.

-1
source

Source: https://habr.com/ru/post/909418/


All Articles