演示效果:
[](()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格式放置在[graphic](()目录下。
在Project窗口,打开“entry > src > main > resources > base”,右键点击“graphic”文件夹,选择“New > File”,命名为“background_text.xml”,在background_text.xml中定义文本的背景。
代码演示:
<?xml version="1.0" encoding="UTF-8" ?><shape xmlns:ohos=“http://schemas.huawei.com/res/ohos”
ohos:shape