How do you scale a square image without losing the aspect ratio (even if the layout is not square)
I'd like to create a square layout so I could scale up/and down a square image I have - using 'android:scaleType="fitXY"'. Other scale types don't work because they don't scale up the image.
The problem is that I can't create an exact square layout. In order for the scaling up to work, I need to give a very big width/height (like 150dp * 150dp).
Sometimes, the image is found within another layout, which it's size I don't know. If the width/height of the layout is smaller than 150dp, the whole layout is filled and the image loses it's aspe开发者_高级运维ct ratio.
How do you scale up and down a square image without losing the aspect ratio?
Thanks.
ImageView.ScaleType
ImageView.ScaleType CENTER_CROP
精彩评论