"Android" Imageview.scaletype Setup plot

Source: Internet
Author: User

ImageView's scaletype determines what the image looks like when it is displayed on the view, such as what scale is scaled, and whether the picture is displayed as a whole or part, and so on.

The ways to set up include:

1. Define android:scaletype= "CENTER" in the layout XML

2. or call Imageview.setscaletype (ImageView.ScaleType.CENTER) in the code;

Next, the value of the ScaleType and the corresponding display effect are described in the most intuitive way-the method that the true figure demonstrates.

First, the original picture used for the test:

(DIMENSIONS:128 * 128)

(dimensions:640 * 428)

OK, start the following test:

1. Setscaletype (ImageView.ScaleType.CENTER);

Centered on the original size of the picture, when the picture is longer/wider than the length/width of the view, the center portion of the image is displayed

2. Setscaletype (ImageView.ScaleType.CENTER_CROP);

Proportionally enlarges the size of the image so that the image is long (wide) equal to or greater than the length (width) of the view

3. Setscaletype (ImageView.ScaleType.CENTER_INSIDE);

Center 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 view

4. Setscaletype (ImageView.ScaleType.FIT_CENTER);

Enlarges/shrinks the image to the width of the view, centered on the display

5. Fit_start, fit_end in the picture zoom effect and fit_center, just show the location of different, Fit_start is placed on the top, Fit_center Center, fit_end at the bottom.

There is no example to show here.

6. Fit_xy

Do not scale the picture proportionally, the goal is to fill the picture with the entire view.

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.