Original address: http://blog.csdn.net/xilibi2003/article/details/6628668
The ScaleType property is often used when using imageview, such as:
<imageview android:layout_width= "50DP" android:layout_height= "50DP" android:scaletype= "Matrix" android:src= "@drawable/sample_small"/>
The individual values of the ScaleType property always do not remember the difference. Find some time to sum up today:
ScaleType attribute values are: Matrix fitxy fitstart fitcenter fitend Center Centercrop centerinside
The differences between them are as follows:
Matrix is used to draw (from the matrix area starting at the top left) fitxy the image to zoom in/out to the view size display (make sure the picture is fully displayed and full of view) Fitstart enlarge/Shrink the picture proportionally to the width of the view. displayed in the upper part of the view (the picture will be displayed in full) fitcenter enlarge/Shrink the picture to the width of the view, centered (the picture will be displayed) Fitend enlarge/Shrink the picture proportionally to the width of the view. displayed in the lower part of the view (the picture will be displayed in full) center by the image of the original size center display, when the picture is wider than the width of the view, then the center portion of the image is captured, when the picture is less than the width of the view, then the picture is centered on the Centercrop proportional expansion/ Reduce the size of the image to the center display, so that the picture is higher than the view, so that the picture width is equal to or greater than the width of the view centerinside the contents of the picture to the full center display, Make the picture scaled down or the original size (picture than view hours) so that the picture width is equal to or less than the width of the view (the picture will be full display) attached two experiments: Figure 1: Picture is larger than ImageView Figure 2: Figure ratio ImageView Small experiment
Android Reprint four: (layout) ImageView ScaleType Property test