Coil automatically adjusts to the scale type of the ImageView
so you don't need to configure the scale.
Picasso does not, and Picasso's .fit().centerInside()
is actually not equivalent to ImageView
's CENTER_INSIDE
but to FIT_CENTER
(it will enlarge the image so that at least one dimension matches the ImageView
). There is no equivalent to CENTER_INSIDE
with Picasso but these are the closest options:
- You can simply remove
.fit().centerInside()
and let the ImageView
scale down the image if it's larger, but if the image is very large it will consume a lot of memory (and may fail to load if larger than the max texture size of the device).
- You can use
.resize(width, height).centerInside().onlyScaleDown()
after measuring the size of the ImageView
manually.
If you want Coil to resize the image the same way Picasso does with .fit().centerInside()
, then just change the scale type of the ImageView
to FIT_CENTER
.