widget.setProperty(propertyId, val)
Set the properties of the UI widget.
Type
(propertyId: string, val: any) => void
Parameters
Parameter | Description | Type |
---|---|---|
propertyId | The property of ID. | PropertyId |
val | Set the value. (when property is hmUI.prop.MORE , val is used in the same way as createWidget's option, which can set multiple parameters.) | any |
PropertyId
List the properties commonly supported by the components.
Properties | Description | Type |
---|---|---|
x | The x-axis coordinate of the component. | number |
y | The y-axis coordinate of the component. | number |
w | The width of the component. | number |
h | The height of the component. | number |
VISIBLE | Whether the widget is visible or not, true is visible, false is not, this property does not support setProperty(hmUI.prop.MORE, {}) , only setProperty sets the VISIBLE property alone | boolean |
Code example
const button = hmUI.createWidget(hmUI.widget.BUTTON, Param)
button.setProperty(hmUI.prop.VISIBLE, false)
const text = hmUI.createWidget(hmUI.widget.TEXT, Param)
text.setProperty(hmUI.prop.MORE, {
x: 0,
y: 0,
w: 200,
h: 200,
text: 'hello',
color: 0x34e073,
align_h: hmUI.align.LEFT
})