ohos:height=“match_content”
ohos:width=“match_content”
ohos:text=“李子捌”
ohos:text_size=“100px”
ohos:text_color=“#000000”
ohos:text_font=“HwChinese-medium”
/>
演示效果:
2.5 italic
| 属性名称 | 中文描述 | 取值 | 取值说明 | 使用案例 |
| — | — | — | — | — |
| italic | 文本是否斜体字体 | boolean类型 | 可以直接设置true/false,也可以引用boolean资源。 | ohos:italic=“true"ohos:italic=”$boolean:true" |
代码演示:
<Text
ohos:id=“$+id:text”
ohos:height=“match_content”
ohos:width=“match_content”
ohos:text=“李子捌”
ohos:text_size=“100px”
ohos:text_color=“#000000”
ohos:text_font=“sans-serif”
ohos:italic=“true”
/>
演示效果:
2.6 text_weight
| 属性名称 | 中文描述 | 取值 | 取值说明 | 使用案例 |
| — | — | — | — | — |
| text_weight | 字重 | integer类型 | 表示字体大小的integer类型。也可以引用integer资源。 | ohos:text_weight=“100"ohos:text_weight=”$integer:100" |
代码演示:
<Text
ohos:id=“$+id:text”
ohos:height=“match_content”
ohos:width=“match_content”
ohos:text=“Liziba”
ohos:text_size=“100px”
ohos:text_color=“#0000FF”
ohos:text_font=“serif”
ohos:italic=“true”
ohos:text_weight=“100”
/>
演示效果:
text_weight = 100
text_weight = 600
2.7 background_element
常用的背景如常见的文本背景、按钮背景,可以采用XML格式放置在