The Android:scaletype effect of ImageView properties

Source: Internet
Author: User

On the internet to check a lot of information, roughly the same, we are copying each other, looking very laborious, bad understanding, their own summary, keep the need to see the words to find.

The examples in the code are as follows:

<imageview android:id= "@+id/iv_bit_1" android:layout_width= "@dimen/passcode_width" and roid:layout_height= "@dimen/passcode_height" android:scaletype= "Fitxy"/> <imageview and Roid:id= "@+id/iv_bit_2" android:layout_width= "@dimen/passcode_width" android:layout_height= "@dimen/P            Asscode_height "android:scaletype=" Fitxy "/> <imageview android:id=" @+id/iv_bit_3 " Android:layout_width= "@dimen/passcode_width" android:layout_height= "@dimen/passcode_height" a Ndroid:scaletype= "Fitxy"/> <imageview android:id= "@+id/iv_bit_4" android:layout_width= "@dimen/passcode_width" android:layout_height= "@dimen/passcode_height" android:scaletype= "Fitxy"/&G        T <imageview android:id= "@+id/iv_bit_5" android:layout_width= "@dimen/passcode_width" and Roid:layout_height= "@dimen/passcode_height" android:scaletype= "Fitxy"/> <imageview android:id= "@+id/ Iv_bit_6 "android:layout_width=" @dimen/passcode_width "android:layout_height=" @dimen/passcode_height "Android:scaletype=" Fitxy "/>

Through the API query, we know that

The structure of the Imageview.scaletype is:

Inheritance relationship

public static final enum Imageview.scaletype extends Enum<e extends enum<e>>

Java.lang.Object

Java.lang.enum<e extends Java.lang.enum<e>>

Android.widget.ImageView.ScaleType

class overview

The option to scale the picture boundaries to fit the view boundaries.

Constant

public static final Imageview.scaletype CENTER

Centers the image in the view without performing a zoom. Syntax that can be used in XML: android:scaletype= "center".

public static final Imageview.scaletype center_crop

Scales the image evenly (preserving the original proportions of the image) so that the two coordinates (width, height) of the picture are greater than or equal to the corresponding view coordinates (negative padding). The image is in the center of the view. Syntax that can be used in XML: android:scaletype= "Centercrop".

public static final Imageview.scaletype center_inside

scale the image proportionally (preserving the original proportions of the image) so that the two coordinates (width, height) of the picture are less than or equal to the corresponding view coordinates (negative padding). The image is in the center of the view. Syntax that can be used in XML: android:scaletype= "Centerinside".

public static final Imageview.scaletype fit_center

Scale the image using the CENTER mode. Syntax that can be used in XML: android:scaletype= "Fitcenter".

public static final Imageview.scaletype fit_end

Use the END method to scale the image. Syntax that can be used in XML: android:scaletype= "Fitend".

public static final Imageview.scaletype fit_start

Use the START mode to scale the image. Syntax that can be used in XML: android:scaletype= "Fitstart".

public static final Imageview.scaletype fit_xy

Causes the image to be scaled in FILL mode. Syntax that can be used in XML: android:scaletype= "Fitxy".

public static final Imageview.scaletype MATRIX

When drawn, scales with an image matrix. The image matrix can be set by Setimagematrix (matrix). Syntax that can be used in XML: android:scaletype= "Matrix".

Here through the reading of a blog, this also has a more detailed explanation, we can refer to:

Http://blog.sina.com.cn/s/blog_407abb0d0100mao1.html

The effect of several attributes is shown in code:

Main interface:

Center effect:

Center_crop Effect:

Center_inside Effect:

Fit_center Effect:

Fit_start Effect:

Fit_end Effect:

Fit_xy Effect:

Matrix Effect:

Results Analysis:

The original picture I selected is clearly marked as follows: There are butterflies, flowers in the upper left corner, and a locust in the lower right corner, and the picture pixels are larger than 320x480, and various types of differences can be glimpse by viewing the visible signs of the picture. For example, Fit_start, fill the top of the screen, and so on scale, instead, Fit_end is placed below the screen, and Fit_center is in the middle. Center_crop cropped the middle part of the picture to fill the screen. Other types can view the analysis on their own.

Transferred from: http://blog.csdn.net/dyllove98/article/details/8827697

The Android:scaletype effect of ImageView properties

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.