3Center/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 displayed4 5Center_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 view6 7Center_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 view8 9Fit_center/fitcenter enlarge/Shrink the picture to the width of the view, centered on the displayTen OneFit_end/fitend Zoom in/out to the width of the view, displayed in the lower part of the view A -Fit_start/fitstart enlarge/Shrink the image to the width of the view, displayed in the upper part of the view - theFit_xy/fitxy The picture is not scaled up/down to the view size display - -Matrix/matrix is plotted using matrices (matrix matrices can be scaled to zoom in and out to show)
1 //get the high and wide bitmap2 intBmpwidth=bmp.getwidth ();3 intBmpheight=bmp.getheight ();4 5 //Set scale down6 Doublescale=0.8;7 //figure out the scale to be narrowed down.8Scalewidth= (float) (Scalewidth*scale);9Scaleheight= (float) (Scaleheight*scale);Ten One //Bitmap object after generating resize AMatrix matrix=NewMatrix (); -Matrix.postscale (ScaleWidth, ScaleHeight); -Bitmap resizebmp=bitmap.createbitmap (BMP, 0, 0, bmpwidth, bmpheight, Matrix,true);
1 <ImageView2 Android:id= "@+id/image" 3 Android:layout_width= "Fill_parent" 4 Android:layout_height= "Fill_parent" 5 Android:scaletype= "Center" 6 android:src= "@drawable/candle" 7 />
ImageView attribute Android:scaletype, i.e. Imageview.setscaletype (Imageview.scaletype)