"Go" ImageView attribute android:scaletype, i.e. Imageview.setscaletype (Imageview.scaletype)

Source: Internet
Author: User

1  Here we focus on understanding ImageView's attribute Android:scaletype, namely Imageview.setscaletype (Imageview.scaletype). Android:scaletype is a size that controls how the picture resized/moved to the ImageView. Imageview.scaletype/android:scaletype Value difference: 2   3 Center/center  by the original size of the picture is displayed, when the picture is longer/wider than the length/width of the view, The center portion of the captured picture is displayed 4   5 center_crop/centercrop  proportionally enlarges the size of the image to the center display, making the picture long (wide) equal to or greater than the view's length (width) 6   7 center_inside/ Centerinside the  contents of the picture to the full center display, by proportionally reduced or the original size so that the picture length/width is equal to or less than the length/width of the view 8   9 Fit_center/fitcenter  enlarge the picture proportionally Zoom to the width of the view, centered  on the fit_end/fitend to   enlarge/shrink the image to the width of the view, shown in the lower part of the view  Fit_start/fitstart  enlarges/shrinks the image to the width of the view, displayed in the upper part of the view.  Fit_xy/fitxy The  picture is not scaled up/down to the size of the view display  MATRIX/ Matrix is used to draw


At first I did not understand matrix matrices, the web search found that the original matrix can be scaled to zoom the image to display, here do not expand in-depth understanding, just post related statements, reduce the image:

1//Get bitmap high and wide  2 int bmpwidth=bmp.getwidth ();  3 int bmpheight=bmp.getheight ();  4   5//Set reduction ratio  6 double scale=0.8;  7//Calculate the ratio to be reduced by  8 scalewidth= (float) (Scalewidth*scale);  9 scaleheight= (float) (Scaleheight*scale); 10  

1 <imageview 2 android:id= "@+id/image" 3     android:layout_width= "Fill_parent"  4     Android:layout_height = "Fill_parent" 5     android:scaletype= "Center" 6     

"Go" 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.