beetlebug

ztk::android::Label

Makes a text (TextView) that wraps at the width of its column.

Synopsis

ztk::android::Label new ?OPTION VALUE ...?
$screen add label ?OPTION VALUE ...?

Arguments

Name Type Default Meaning
-text text empty The text.
-font text style body The size in sp, so it follows the font size of the system: largeTitle 32, title 28, title2 24, title3 22, headline 16 medium, body 16, callout 15, subheadline 14, footnote 13, caption 12, caption2 11 medium.
-color color label #RRGGBB, or a name. label, secondaryLabel, tertiaryLabel, and placeholderText are the text colors of the theme. tint is colorAccent, and systemBackground is colorBackground. systemBlue, systemRed, systemGreen, systemOrange, systemYellow, systemPink, systemPurple, systemTeal, systemIndigo, systemGray, black, and white are the same in each mode.
-lines integer 0 The most lines of the text. 0 is no limit.
-align natural, left, center, right natural The alignment. natural and left follow the direction of the language, and right is the other side.
-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 gives the object.

Errors

Error When
bad font "NAME": must be body, callout, caption, caption2, footnote, headline, largeTitle, subheadline, title, title2, or title3 An unknown text style.
bad color "NAME": must be a color of the system, such as label or systemBlue, or #RRGGBB An unknown color.
expected integer but got "X" -lines is no integer.
bad align "X": must be center, left, natural, or right -align has another value.
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.

Platforms

Platform Works
Windows No
macOS No
Linux, Wayland No
Linux, X11 No
Web No
iOS No: ztk::ios::Label
Android Yes
Headless No: the namespace does not exist.

Example

set screen [ztk::android::Screen new -title Note]
$screen add label -text "Saved." -font headline -color systemGreen -align center
ztk::android::app root $screen

See also