ImageView's scaletype determines what the image looks like when it is displayed on the view, such as the scale of the zoom, and the overall or partial display of the picture, and so on.
The way you set it includes:
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 image 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 the location of the display is different, Fit_start is placed on the top, Fit_center Center, fit_end at the bottom.
The demo sample is not given here.
6. Fit_xy
Do not scale the picture proportionally, the goal is to fill the picture with the entire view.
[Android] Imageview.scaletype setting plots