ImageView attribute Android:scaletype, i.e. Imageview.setscaletype (Imageview.scaletype)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.