ImageView's ScaleType details (drawings)

Source: Internet
Author: User

There are several properties of ImageView's scaletype, namely matrix (default), center, Centercrop, Centerinside, Fitcenter, Fitend, Fitstart, Fitxy


Android:scaletype= "Center"

Keep the size of the original, displayed in the center of the ImageView. When the size of the original image is larger than the size of ImageView, the partial cropping is exceeded.


Android:scaletype= "Centercrop"

To fill the whole imageview for the purpose, the center of the original image to the center of the ImageView, and so on to enlarge the original image until the filling imageview (refers to the width and height of the ImageView to fill), the original version of more than the imageview part of the cut.


Android:scaletype= "Centerinside"

For the purpose of full display of the original image, the content of the picture is completely centered, and the size width (height) of the original is reduced by proportionally to or less than the width of the ImageView (high). If the size of the original is smaller than the size of ImageView, the size of the original is not processed and centered on the ImageView.


Android:scaletype= "Matrix"

Do not change the size of the original, from the upper left corner of the ImageView to draw the original image, the original more than the ImageView part for clipping.

Android:scaletype= "Fitcenter"

Enlarge or narrow the original image to the height of the imageview of the ImageView, centering on the display

Android:scaletype= "Fitend"

Enlarge (shrink) The original image to the height of the ImageView, shown in the lower part of the ImageView

Android:scaletype= "Fitstart"

Enlarge (shrink) The original image to the height of the ImageView, shown in the upper part of the ImageView

Android:scaletype= "Fitxy"

The original image is displayed in the view according to the specified size, stretched to show the picture, does not maintain the original proportions, fills the ImageView.

Tip: A lot of people think Fitcenter and centerinside no difference, according to the above effect diagram analysis, in fact, there is a difference. Fitcenter is to enlarge or reduce the original image, so that the height of the original is equal to the height of ImageView, and center display,

and Centerinside in the original size larger than ImageView size, then reduce the original, the effect with fitcenter; When the original size of the original is smaller than the size of the ImageView, no size processing is performed, the center is displayed, Effect with center.



A property that is basically not available:

The Android:adjustviewbounds property of the ImageView is to maintain the aspect ratio of the original, the individual settings do not work and need to be used in conjunction with MaxWidth or MaxHeight.

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.