This is an overview of the most common usage of Label. For more information about the available properties, methods, or events, head over to the complete API documentation for Label.
<Label> 是一个显示只读文本的UI组件。
重要提示: 此 <Label> 不是 与 HTML一样的 <Label>.
<Label text="Label" />

如果需要设置文本的部分样式,可以使用 FormattedString 和 Span 元素的组合。
<Label textWrap="true">
<FormattedString>
<Span text="This text has a " />
<Span text="red " style="color: red" />
<Span text="piece of text. " />
<Span text="Also, this bit is italic, " fontStyle="italic" />
<Span text="and this bit is bold." fontWeight="bold" />
</FormattedString>
</Label>| 名称 | 类型 | 描述 |
|---|---|---|
text | String | 获取或设置标签的文本。 |
textWrap | Boolean | 获取或设置标签是否包装文本。 默认值: false。 |
| Android | iOS |
|---|---|
android.widget.TextView | UILabel |