Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Native
Skip to main content

Struct Fit

sealed struct Fit
Options for scaling the bounds of an IImage to the bounds of IImageView.

Fields

Constants

COVER

Fit = {0}
Scale the IImage uniformly (maintain the aspect ratio) so that both dimensions (width and height) of the IImage will be equal to or larger than the corresponding dimension of the IImageView.

CONTAIN

Fit = {1}
Scale the IImage uniformly (maintain the aspect ratio) so that both dimensions (width and height) of the IImage will be equal to or less than the corresponding dimension of the IImageView.

STRETCH

Fit = {2}
Scale width and height independently (without maintaining the aspect ratio).

REPEAT

Fit = {3}
Repeat the IImage to cover the frame of the IImageView. The IImage will keep its size and aspect ratio, unless it is larger than the IImageView, in which case it will be scaled down uniformly so that it is contained in the IImageView.

CENTER

Fit = {4}
Center the IImage in the IImageView along both dimensions. If the IImage is larger than the view, scale it down uniformly so that it is contained in the IImageView.

NONE

Fit = {5}
The IImage is not resized and is displayed at its original size, anchored to the top-left of the IImageView. This is useful when pixel-exact rendering is needed, such as icons or pre-rendered assets. If the image dimensions are greater than the IImageView dimensions, the image will be clipped to the IImageView bounds. If the image is smaller than the IImageView, the remaining area is not painted and remains transparent.

SCALE_DOWN

Fit = {6}
Scales the IImage uniformly (preserving the aspect ratio) to fit within the IImageView dimensions only if the image is larger than the view. If the image is smaller than or equal to the view, it is displayed at its original size, anchored to the top-left of the IImageView. This behaves like Fit::NONE, but scales down if the image exceeds the view bounds.
Last modified on October 29, 2026