(Transferred from: http://www.open-open.com/lib/view/open1378257991687.html)
| 1 2 3 4 5 6 |
<ImageView android:id="@+id/img" android:src="@drawable/logo" android:<span style="color:#ff0000;">scaleType</span>="centerInside" android:layout_width="60dip" android:layout_height="60dip" android:layout_centerVertical="true"/> |
Attached: More detailed description of ScaleType:
Android:scaletype is a size that controls how the picture resized/moved to the ImageView.
The meaning difference of Imageview.scaletype/android:scaletype value:
Center/center is centered on the original size of the image, and when the picture is longer/wider than the length/width of the view, the center portion of the image is displayed
Center_crop/centercrop proportionally enlarges the size of the image so that the image is long (wide) equal to or greater than the length (width) of the view
Center_inside/centerinside Displays the contents of the picture in full, by scaling it down or the original size to make the picture long/wide equal to or less than the length/width of the view
Fit_center/fitcenter enlarge/Shrink the picture to the width of the view, centered on the display
Fit_end/fitend Zoom in/out to the width of the view, displayed in the lower part of the view
Fit_start/fitstart enlarge/Shrink the image to the width of the view, displayed in the upper part of the view
Fit_xy/fitxy The picture is not scaled up/down to the view size display
The Matrix/matrix is drawn with a matrix and is displayed by zooming in and out of the image.
Android ImageView (ScaleType properties) (EXT)