Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

What happens if only fitwidth is set in imageview?


Asked by Genesis McCarthy on Dec 05, 2021 FAQ



If only fitWidth is set, image's view width is scaled to match and height is unchanged; If only fitHeight is set, image's view height is scaled to match and height is unchanged; If both are set, the image view is scaled to match both.
Besides,
The result is the same as with fit_center. Because we use adjustViewBounds and we set the height, the ImageView has the same aspect ratio as the image and the image is perfectly aligned. In this case the difference with fit_center is the image is now being aligned to the right and bottom of the ImageView.
Also Know, In this case having adjustViewBounds or not doesn’t make a difference. The reason is because the image is scaled uniformly so it maintains the aspect ratio but because the image will be equal or larger than the ImageView the width of the ImageView is going to be larger in both cases.
In fact,
The reason is because the image is scaled uniformly so it maintains the aspect ratio but because the image will be equal or larger than the ImageView the width of the ImageView is going to be larger in both cases. This result is also the same as using center without adjustViewBounds.
Additionally,
Sets the value of the property fitWidth. The width of the bounding box within which the source image is resized as necessary to fit. If set to a value <= 0, then the intrinsic width of the image will be used as the fitWidth .