[Android beginners] 5. How to Use Controls-ImageView, android-imageview

Source: Internet
Author: User

[Android beginners] 5. How to Use Controls-ImageView, android-imageview
Start Android

1. Basic concepts of Image view 2. <InameView/> and ImageView 3. Magic ScaleType attribute when the image size does not match the ImageView size, you can use this attribute to adjust the location relationship between the image and the ImageView control.

Android: scaleType: 
Android: scaleType controls how images are resized/moved to match the size of ImageView.

  ImageView. ScaleType/android: the differences between scaleType values: 

CENTER/center is centered according to the original size of the image. When the length/width of the image exceeds the length/width of the View, the CENTER part of the captured image is displayed.

CENTER_CROP/centerCrop scales up the image size in the center, so that the image length (width) is equal to or greater than the View length (width)

CENTER_INSIDE/centerInside shows the entire content of the image in the center. The image length/width is equal to or less than the View length/width by proportional reduction or the original size.

FIT_CENTER/fitCenter scales up/down the image proportionally to the width of the View and center the image.

FIT_END/fitEnd: scales up or down an image to the width of the View, which is displayed in the lower part of the View.

FIT_START/fitStart scales up/down an image proportionally to the width of the View.

FIT_XY/fitXY increase or decrease the image size proportionally to the View size.

MATRIX/matrix is drawn using a MATRIX to dynamically zoom in and zoom in images.

Note that the names of images in the Drawable folder cannot be capitalized.

1. Use the <ImageView/> label in the XML file

2. Use the ImageView object in the code
How does android draw points on the imageview control?

Android: scaleType:
Android: scaleType controls how images are resized/moved to match the size of ImageView.
ImageView. ScaleType/android: the differences between scaleType values:
CENTER/center is centered according to the original size of the image. When the length/width of the image exceeds the length/width of the View, the CENTER part of the captured image is displayed.
CENTER_CROP/centerCrop scales up the image size in the center, so that the image length (width) is 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 in the center.
FIT_END/fitEnd: scales up or down an image to the width of the View, which is displayed in the lower part of the View.
FIT_START/fitStart scales up/down an image proportionally to the width of the View.
FIT_XY/fitXY? Scale up or down to display the View Size in proportion
MATRIX/matrix is drawn using a MATRIX to dynamically zoom in and zoom in images. ** Note,

The names of images in the Drawable folder cannot be capitalized.
 
How to draw points on the ImageView control in android Development

Write a class that inherits from ImageView and overwrite its OnTouch () and OnDraw () classes. The first class gets the touch point, and the last class is drawn at this point.
 

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.