android - CENTER_CROP does not maintain image ratio -


By reading the Android Dock, I expect a picture with this layout:

  Lt; Android: id = "@ + id / avatar" Android: layout_width = "fill_parent" Android: layout_height = "150dip" Android: Adjusted ViewBounds = "true" Android: scaleType = "centerCrop" />   

To fill the layout (height of 150 dip is the only condition): Without any distortion:

CENTER_CROP Scale Image Similar By form (maintain aspect ratio of the image) so that both dimensions of the image (width and height) equal to or equal to the dimension (zero padding) similar to the view.

Works very well on that phone:

Enter image details here

But the image on the tablet is completely deformed:

 Enter image details here

How is it possible to say:" Please do not stretch horizontally "

I think you should 're-specify the background instead of the image in the form of an image. Images are also extended on the phone, and the centerpop should work fine.

Try using the setImageBitmap or "src" attribute and let me know that it works.

Comments