The LzLayout class is a subclass of LzNode that is responsible for laying out views. The LzLayout class is a base class that provides this functionality. You never instantiate this class directly, but always create an instance of its subclass. Subclasses of LzLayout are shown in Figure 4.2.
The attributes defined in the LzLayout class are given in Table 4.1.
Name | Usage | Type | Default | Accessibility |
---|---|---|---|---|
delegates | JS only | array of LzDelegate objects | read-only | |
Description. All the delegates used by the layout. | ||||
locked | Tag and JS | boolean | read-write | |
Description. Indicates whether or not the layout is locked from updates. | ||||
subviews | JS only | array of views | read-only | |
Description. All the views managed by this layout. | ||||
updateDelegate | JS only | LzDelegate | read-only | |
Description. A delegate responsible for updating the layout. |
The following are methods defined in the LzLayout class.
addSubview(subview)
Adds the specified subview.
ignore(subview)
Ignores the specified subview.
lock()
Locks the layout so no updates are allowed.
releaseLayout()
Removes the layout from the view and deregisters the delegates that the layout uses.
removeSubview(subview)
Removes the specified subview.
setLayoutOrder(subView1, subView2)
swapSubviewOrder(subView1, subView2)
Swaps the positions of subView1 and subView2.
unlock()
Unlocks the layout so that updates are allowed.
You can specify a layout by using the layout attribute of the LzView class or, as demonstrated in the later sections, by instantiating a subclass of LzLayout.