SvgImageView
An element which is used to display Scalable Vector Graphics (SVG) images
Create from source
func NewSvgImageView(session Session, params Params) SvgImageView
Create new SVG image view object and returns its interface
Create from resource
SvgImageView {
id = svgImageView,
content = "icon.svg",
}
Interface description
Inherit methods, properties and events from View
Properties
"cell-horizontal-align"
Same as "horizontal-align"
Constant: CellHorizontalAlign
"cell-vertical-align"
Same as "vertical-align"
Constant: CellVerticalAlign
"content"
Image to display. Could be the image file name in the images folder of the resources, image URL or content of the svg image
Constant: Content
Types: string
Examples
SvgImageView {
width = 100%,
height = 100%,
content = "settings.svg",
}
image := rui.NewSvgImageView(session, rui.Params{
rui.Width: rui.Percent(100),
rui.Height: rui.Percent(100),
rui.Content: "settings.svg",
})
image := rui.NewSvgImageView(session, rui.Params{
rui.Width: rui.Percent(100),
rui.Height: rui.Percent(100),
rui.Content: `<svg width="32" height="32" version="1.1" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"> <g transform="translate(-499.08 -247.12)"> <path d="m508.08 249.12 14 14-14 14" fill="none" stroke="#0f0" stroke-linecap="round" stroke-width="1px"/> </g> </svg>`,
})
image := rui.NewSvgImageView(session, rui.Params{
rui.Width: rui.Percent(100),
rui.Height: rui.Percent(100),
rui.Fit: rui.ContainFit,
rui.Content: "https://upload.wikimedia.org/wikipedia/commons/c/c1/Google_%22G%22_logo.svg",
})
"horizontal-align"
Sets the horizontal alignment of the image relative to its bounds
Constant: HorizontalAlign
Types: int
, string
Values
int | string | Description |
---|---|---|
0 (LeftAlign ) |
"left" | Left alignment |
1 (RightAlign ) |
"right" | Right alignment |
2 (CenterAlign ) |
"center" | Center alignment |
"vertical-align"
Sets the vertical alignment of the image relative to its bounds
Constant: VerticalAlign
Types: int
, string
Values
int | string | Description |
---|---|---|
0 (TopAlign ) |
"top" | Top alignment |
1 (BottomAlign ) |
"bottom" | Bottom alignment |
2 (CenterAlign ) |
"center" | Center alignment |
Related global functions
func GetSvgImageViewHorizontalAlign(view View, subviewID ...string) int
Return the vertical align of an SvgImageView
subview: LeftAlign
(0), RightAlign
(1), CenterAlign
(2). If the second argument (subviewID) is not specified or is an empty string then a left position of the first argument (view) is returned
func GetSvgImageViewVerticalAlign(view View, subviewID ...string) int
Return the vertical align of an SvgImageView
subview: TopAlign
(0), BottomAlign
(1), CenterAlign
(2). If the second argument (subviewID) is not specified or is an empty string then a left position of the first argument (view) is returned