Whenever I assign background to a view that is laid out with wrap_content, if the background image is larger than a view, the view is stretched so that it can hold the entire ba
Why is it so? Because you set the width to wrap_content
.
How can you prevent it:
a. Set the maxWidth
attribute.
b. Try placing the ImageView
with wrap_content
inside a Layout that has a fixed width.
c. (I often use TableLayout as its shrinkColumns and stretchColumns attribute are handy for things like this. Maybe this can work for you too.)
Too help more, some XML is needed.