ztk::android::Stack
Makes a row or a column of views (LinearLayout).
Synopsis
ztk::android::Stack new ?OPTION VALUE ...?
$screen add stack ?OPTION VALUE ...?
Arguments
| Name |
Type |
Default |
Meaning |
-axis |
vertical, horizontal |
vertical |
A column or a row. |
-spacing |
number |
8 |
The dp between views. |
-alignment |
fill, leading, center, trailing |
fill |
The place of each view across the axis. fill gives each view of a column the width of the column, and each view of a row the height of the row. |
add KIND ?OPTION VALUE ...? |
method |
|
As add of a screen. The stack frees the controls of its add calls. |
views |
method |
|
Gives the controls of add, in their order. |
-hidden |
boolean |
0 |
1 hides the view, and its column or row closes the gap. |
-accessibilityLabel |
text |
empty |
The name that TalkBack reads: the content description of the view. |
-accessibilityHint |
text |
empty |
Android has no hint for a view: the option keeps its value and has no effect. |
Return value
new and add give an object. views gives a list.
Errors
| Error |
When |
unknown option "-X": must be ... |
The class has no such option. The message lists the options. |
value for "-X" missing |
configure has an option with no value. |
bad axis "X": must be horizontal or vertical |
-axis has another value. |
expected number but got "X" |
-spacing is no number. |
bad alignment "X": must be center, fill, leading, or trailing |
-alignment has another value. |
bad kind "KIND": must be button, datepicker, label, stack, switch, textfield, or textview |
add has another kind. |
| Platform |
Works |
| Windows |
No |
| macOS |
No |
| Linux, Wayland |
No |
| Linux, X11 |
No |
| Web |
No |
| iOS |
No: ztk::ios::Stack |
| Android |
Yes |
| Headless |
No: the namespace does not exist. |
Example
set screen [ztk::android::Screen new -title Settings]
set row [$screen add stack -axis horizontal -spacing 12]
$row add label -text "Wi-Fi"
$row add switch -on 1
See also