Align image in vertical and vertical image

Say I have an ImageView with this aspect ratio

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

I want to be able to insert images into it that can have different proportions.

If the image has this relationship

 00 00 00 

I want him to be

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

So android: scaleType = "fitEnd" will work

But if I have an image with an attitude

 00000 

I want him to be

 ##### 00000 ##### 

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

Is there a way to combine this?

+4
source share
1 answer

You cannot use two scaleTypes in the same attribute. You may need to wait for the image to load, and then decide what scaleType use with imgView.setScaleType(ImageView.ScaleType.CENTER) or so.

+1
source

All Articles