The ScaleType attribute 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 drawn with matrices (The matrix region starting from the upper-left corner)
Fitxy the picturedo not proportionallyExpands/shrinks to view size display (ensuresThe picture will be displayed in full, and full view)
Fitstart the pictureScaled up /downTo the width of the view, displayed in the upper part of the view (The picture will be displayed in full)
Fitcenter the pictureproportionallyExpands/shrinks to the width of the view, centering the display (The picture will be displayed in full)
Fitend the pictureproportionallyExpands/shrinks to the width of the view, displayed in the lower part of the view (The picture will be displayed in full)
Center by the original size of the picture is displayed, 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, the picture is centered
Centercrop PressproportionsEnlarge/Reduce the size of the image is centered, 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 willthe contents of the picture are displayed in full center, so that the picture is scaled down or the original size (the picture is more than the view hour) so that the picture width is equal to or less than the width of the view (The picture will be displayed in full)
Two experiments are attached:
Figure 1: The picture is larger than the ImageView
Fig. 2: Small experiment of graph ratio ImageView
======================================================================
statement:@Tiny Bear
This blog post can be reproduced arbitrarily, but must retain this paragraph statement and the original address of each article.
The author reserves the right not to use it for any commercial purpose without the author's permission.
Original address: http://blog.csdn.net/xilibi2003/article/details/6628668
Android ImageView ScaleType Properties