What i need is that image should be scaled till it retains the exact proportions after that it should not be scaled further, so that every time width is equal to height of the image view.

As if don't scale properly it will get out of shape, and i need it to be in 1:1 ratio of width and height.

Will

 Imageview:scale="fitxy"

work in this case ?

Please help thnk you.

I am working on android ICS

有帮助吗?

解决方案

To keep aspect ratio, you should make the image the src rather than background.

Take a look at the ScaleType documentation here http://developer.android.com/reference/android/widget/ImageView.ScaleType.html.

You should try using either android:scaleType="centerInside" or android:scaleType="centerCrop".

Hope that helps!

其他提示

android:scaleType="fitXY"

Fits the screen size of the device.

Try this adding this

    android:layout_height="150dp" //or your designed proportion
    android:layout_width="150dp" //or your designed proportion
    android:scaleType="fitXY"
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top