Scaletype attribute of imageview

Source: Internet
Author: User
The property Android: scaletype of imageview, that is, imageview. setscaletype (imageview. scaletype ). Android: scaletype controls how images are resized/moved to match the size of imageview. Imageview. scaletype/Android: The difference between scaletype values: center/center is displayed in the center of the original size of the image. When the length/width of the image exceeds the length/width of the view, then, the center part of the captured image is displayed. center_crop/centercrop scales up the image size in the center to make the image length (width) equal to or greater than the view length (width) center_inside/centerinside displays the image content in the center, scale down the image size proportionally or make the image length/width equal to or less than the view length/width fit_center/fitcenter to scale up/down the image to the view width proportionally, in the center, fit_end/fitend is used to increase or decrease the image width proportionally to the view width. in the lower part of the view, fit_start/fitstart is used to increase or decrease the image width proportionally to the view width, in the top part of the view, fit_xy/fitxy expands or scales down the image proportionally to the view size. The matrix/matrix is used to draw the matrix at the beginning, after searching on the internet, I found that the original matrix can be dynamically zoomed in and enlarged to display the image. Here I am not going to understand it in depth. I just posted the relevant statements to narrow down the image: // obtain the height and width of Bitmap int BMP = BMP. getwidth (); int bmpheight = BMP. getheight (); // set the scale-down ratio to double scale = 0.8; // calculate the scale-down ratio scalewidth = (float) (scalewidth * scale); scaleheight = (float) (scaleheight * scale); // The bitmap object after Resize is generated. Matrix matrix = new matrix (); matrix. postscale (scalewidth, scaleheight); bitmap resizebmp = bitmap. createbitmap (BMP, 0, 0, BMP width, bmpheight, matrix, true );
Related Article

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.