Eitanos30
Eitanos30

Reputation: 1429

How does scaleType and wrap_content determine ImageView width and height?

I'm trying to understand how layout_width/height when sets to "wrap_content", "goes" together with scaleType? AFAIK, scaleType (let's say 'center_fit') responsible of scaling up or down image size, but when width or height is set to wrap_content, isn't it means that the width & height of the ImageView will be calculated from the image (drawable) size? So why in this situation, the drawable will be scaled at all?

Upvotes: 1

Views: 401

Answers (1)

Mike
Mike

Reputation: 1343

scaleType defines how you want your image to appear in the case that the width and height isn't match / appropriate e.g. fitCenter makes it centered and fit, while fitXY stretches it if it has spaces.

Upvotes: 1

Related Questions