Android : Android: ImageView, keep the aspect ratio

on Monday, October 6, 2014


Lets say I have image test.png with size h:40px w:80px


And I have ImageView, with height: 80px.


How to set image to this ImageView, so that image could fit ImageView but proportionally ?


So I need image to fit height, that mean it should become 80px height, and fit width as much as needed for image to be proportional, so width should become 160px


I know I can just cut a bigger image, its not a solution for me.


Tried:



android:adjustViewBounds="true"
android:scaleType="fitXY"


but its not adjust width.


0 comments:

Post a Comment