Skip to main content
Version: v3+

setLayoutParent(parent)

Supported from API_LEVEL 4.0. For API compatibility, please refer to API_LEVEL.

Sets the parent node of the current node.

Type

(parent: UIWidget) => void

Parameters

ParameterTypeDescription
parentUIWidgetWidget instance object participating in layout

Example

const container = hmUI.createWidget(hmUI.widget.VIRTUAL_CONTAINER, {
x: 0,
y: 0,
w: 480,
h: 480
})

const text = hmUI.createWidget(hmUI.widget.TEXT, {
text: 'Hello Zepp OS'
})

// Set text widget as child node of container
text.setLayoutParent(container)