ImageView's scaletype determines what the image looks like when it is displayed on the view, such as what scale is scaled, and whether the picture is displayed as a whole or part, and so on.
The ways to set up include:
1. Define android:scaletype= "CENTER" in the layout XML
2. or call Imageview.setscaletype (ImageView.ScaleType.CENTER) in the code;
Next, the value of the ScaleType and the corresponding display effect are described in the most intuitive way-the method that the true figure demonstrates.
First, the original picture used for the test:
(DIMENSIONS:128 * 128)
(dimensions:640 * 428)
OK, start the following test:
1. Setscaletype (ImageView.ScaleType.CENTER);
Centered on the original size of the picture, when the picture is longer/wider than the length/width of the view, the center portion of the image is displayed
2. Setscaletype (ImageView.ScaleType.CENTER_CROP);
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
3. Setscaletype (ImageView.ScaleType.CENTER_INSIDE);
Center 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
4. Setscaletype (ImageView.ScaleType.FIT_CENTER);
Enlarges/shrinks the image to the width of the view, centered on the display
5. Fit_start, fit_end in the picture zoom effect and fit_center, just show the location of different, Fit_start is placed on the top, Fit_center Center, fit_end at the bottom.
There is no example to show here.
6. Fit_xy
Do not scale the picture proportionally, the goal is to fill the picture with the entire view.