Image
<Image>
is a UI component that shows an image from an ImageSource or from a URL.
Tip When working with images following the best practices is a must. |
Examples
Example: Displaying an image from a URL
Setting |
<image
src="https://art.nativescript.org/logo/export/NativeScript_Logo_Blue_White.png"
stretch="aspectFill"
/>
<image
src="https://art.nativescript.org/logo/export/NativeScript_Logo_Blue_White.png"
stretch="aspectFill"
/>
<Image
src="https://art.nativescript.org/logo/export/NativeScript_Logo_Blue_White.png"
stretch="aspectFill"
/>
<image
src="https://art.nativescript.org/logo/export/NativeScript_Logo_Blue_White.png"
stretch="aspectFill"
>
</image>
<image
src="https://art.nativescript.org/logo/export/NativeScript_Logo_Blue_White.png"
stretch="aspectFill"
/>
Example: Displaying a base64
-encoded image
<image src="data:Image/png;base64,iVBORw..." stretch="aspectFill" />
<image src="data:Image/png;base64,iVBORw..." stretch="aspectFill" />
<Image src="data:Image/png;base64,iVBORw..." stretch="aspectFill" />
<image src="data:Image/png;base64,iVBORw..." stretch="aspectFill"></image>
<image src="data:Image/png;base64,iVBORw..." stretch="aspectFill" />
Example: Image with CSS and an icon fonts
<image src.decode="font://" class="fas" />
In NativeScript-Vue, |
<image src="font://" class="fas" />
<Image src="font://" class="fas" />
<image src="font://" class="fas"></image>
<image src="font://" class="fas" />
Props
Name | Type | Description |
---|---|---|
|
|
Gets or sets the source of the image as a URL or an image source.
If you use the new font:// icon protocol in {N} 6.2, make sure you add .decode to the name of the property - e.g.
|
|
Gets or sets the image source of the image. |
|
|
|
(Style property) Sets a color to tint template images. |
|
|
(Style property) Gets or sets the way the image is resized to fill its allocated space.
+ Valid values: |
|
Gets or sets the loading strategy for the images on the local file system.
+ Valid values: |
|
|
|
Additional inherited properties are not shown. Refer to the API Reference |