Pregunta

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

¿Fue útil?

Solución

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!

Otros consejos

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"
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top