Reputation: 19273
I have been using Android for a while, and most of times I have used the background property of view objects to refer to some drawable in my project, mostly because i add some content or functionality to the image.
However recently I'm working on a project that requires many static images that just sit there without additional functionality, thus I'm using the ImageView.
However, i have not understood completely the advantage of using an ImageView, but only because the scaleType
Upvotes: 3
Views: 1898
Reputation: 7123
A background is a background as in, content can sit over it. An ImageView is a View as in it exists alongside the content. This is the basis on which you decide which one to use.
As for rendering efficiency: besides the draw part, which is common to both, an ImageView is also a part of the layout computation process, so adding an ImageView when you don't need it adds extra load on the layout computation. Which is why, though you can an ImageView to act as a background for content, you wouldn't want to do that.
Now if you missed the scaleType functionality when you use backgrounds, look into this: https://groups.google.com/forum/?fromgroups#!topic/android-developers/HuF7pO4fovA
Upvotes: 5