The Image
widget shows an image in your mobile application.
Note: When working with images following the best practices is a must.
<!-- Using a resource image (logo_white_bg.png) from App_Resources/<platform> folders -->
<Image src="res://logo_white_bg" stretch="aspectFill"></Image>
<!-- Using local image from app/images/logo.png -->
<Image src="~/images/logo.png" stretch="aspectFit"></Image>
<!--
Setting loadMode to async will prevent freezing the UI
on Android when loading photos async (e.g. frm online API)
-->
<Image src="~/images/logo.png" loadMode="async" stretch="aspectFit"></Image>
Image {
width: 50;
height: 50;
}
.fas {
font-family: "Font Awesome 5 Free", "fa-solid-900";
font-weight: 900;
}
.t-36 {
font-size: 36;
}
Improve this document
Demo Source
<StackLayout height="100%" class="m-15" backgroundColor="lightgray">
<!-- Image with CSS and an icon fonts -->
<Image src="font://" class="fas t-36"></Image>
<!-- Image with stretch property ("none", "aspectFill" and "aspectFit") -->
<Image src="res://logo_white_bg" stretch="aspectFill"></Image>
</StackLayout>
Image {
width: 100;
height: 100;
}
.fas {
font-family: "Font Awesome 5 Free", "fa-solid-900";
font-weight: 900;
}
.t-36 {
font-size: 36;
}
Improve this document
Demo Source
Name |
Type |
Description |
decodeHeight |
Length |
[Android only] Gets or sets the desired decode height of the image. |
decodeWidth |
Lengt |
[Android only] Gets or sets the desired decode width of the image. |
isLoaded |
boolean |
Gets a value indicating if the image is loaded. |
isLoading |
boolean |
Gets a value indicating if the image is currently loading. |
loadMode |
"sync", "async"
|
Gets or sets the loading strategy for images on the local file system. |
src |
string |
Gets or sets the source of the Image. This can be either an URL string or a native image instance. |
stretch |
Stretch |
Gets or sets the image stretch mode. |
tintColor |
Color |
A color used to tint template images. |