Skip to main content
Version: v3

STROKE_RECT

Start from API_LEVEL 2.0 . Please refer to API_LEVEL.

stroke_rect_sample

The stroked rectangle widget adds a stroke on the basis of the filled rectangle widget.

Create UI widget

import { createWidget, widget } from '@zos/ui'

const strokeRect = createWidget(widget.STROKE_RECT, Param)

Type

Param: object

PropertiesDescriptionRequiredType
xThe x-axis coordinate of the widget.YESnumber
yThe y-axis coordinate of the widget.YESnumber
wThe width of the widget.YESnumber
hThe height of the widget.YESnumber
colorThe widget's color.YESnumber
radiusThe rectangle's rounded corners.NOnumber
line_widthThe width of stroke.NOnumber
angleRotation angle.NOnumber

Code example

import { createWidget, widget, prop } from '@zos/ui'

Page({
build() {
const strokeRect = createWidget(widget.STROKE_RECT, {
x: 125,
y: 125,
w: 230,
h: 150,
radius: 20,
line_width: 4,
color: 0xfc6950
})

strokeRect.addEventListener(event.CLICK_DOWN, (info) => {
strokeRect.setProperty(prop.MORE, {
y: 200
})
})
}
})