4
votes

Let's say i have an ImageView with this aspect ratio

#####
#####
#####

I want to be able to fit images in it that can have different aspect ratios.

If an Image has this ratio

00
00
00

I want it to be

###00
###00
###00

So android:scaleType="fitEnd" would work

But if I have an image with a ratio of

00000

I want it to be

#####
00000
#####

so here android:scaleType="fitCenter" is needed.

Is there a way to combine this?

1

1 Answers

1
votes

You can't use two scaleTypes in the same attribute. You may need to wait for the image to be loaded and then decide what scaleType use with imgView.setScaleType(ImageView.ScaleType.CENTER) or so.