| Start | ||||
|---|---|---|---|---|
| Set tint Set a tinting color for the image. By default, the tint will blend using set tint using XML attribute: Note: Must be a color value, in the form of set tint programmatically: and you can clear this color filter: Example: |
||||
| Set alpha "alpha" is used to specify the opacity for an image. set alpha using XML attribute: Note: takes float value from 0 (transparent) to 1 (fully visible) set alpha programmatically: |
||||
| Set Scale Type Controls how the image should be resized or moved to match the size of XML attribute: i will illustrate different scale types with a square scaleType must be one of the following values:
|
||||
Set Image Resource set a drawable as content of set a drawable programmatically: |
||||
| ImageView ScaleType - Center The image contained in the ImageView may not fit the exact size given to the container. In that case, the framework allows you to resize the image in a number of ways. Center This will not resize the image, and it will center it inside the container (Orange = container) In case that the ImageView is smaller than the image, the image will not be resized and you will only be able to see a part of it strong text |
||||
| ImageView ScaleType - CenterCrop Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or larger than the corresponding dimension of the view (minus padding). Official Docs (opens new window) When the image matches the proportions of the container: When the image is wider than the container it will expand it to the bigger size (in this case height) and adjust the width of the image without changing it's proportions, causing it to crop. |
||||
| ImageView ScaleType - CenterInside Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or less than the corresponding dimension of the view (minus padding). Official Docs (opens new window) It will center the image and resize it to the smaller size, if both container sizes are bigger it will act the same as center. But if one of the sizes are small, it will fit to that size. |
||||
| ImageView ScaleType - FitStart and FitEnd Scale the image using START. Scale the image using END. Official Docs (opens new window) FitStart This will fit to the smallest size of the container, and it will align it to the start. FitEnd This will fit to the smallest size of the container, and it will align it to the end. |
||||
| ImageView ScaleType - FitCenter Scale the image using CENTER. Official Docs (opens new window) This expands the image to try to match the container and it will align it to the center, it will fit to the smaller size. Bigger height ( fit to width ) Same width and height. |
||||
| ImageView ScaleType - FitXy Scale the image using FILL. Official Docs (opens new window) |
||||
| MLRoundedImageView.java Copy and Paste following class in your package: Use this Class in XML with package name instead of Syntax
Parameters
|
Read Article
https://develop.horje.com/learn/1434/reference