常用组件
Text
设置文本样式
Text组件用于在界面上展示一段文本信息,可以包含子组件Span。
名称 |
参数类型 |
描述 |
fontColor |
ResourceColor |
设置文本颜色。 |
fontSize |
Length | Resource |
设置文本尺寸,Length为number类型时,使用fp单位。 |
fontStyle |
FontStyle |
设置文本的字体样式。默认值:FontStyle.Normal。 |
fontWeight |
number | FontWeight | string |
设置文本的字体粗细,number类型取值[100, 900],取值间隔为100,默认为400,取值越大,字体越粗。string类型仅支持number类型取值的字符串形式,例如“400”,以及“bold”、“bolder”、“lighter”、“regular”、“medium”,分别对应FontWeight中相应的枚举值。默认值:FontWeight.Normal。 |
fontFamily |
string | Resource |
设置文本的字体列表。使用多个字体,使用“,”进行分割,优先级按顺序生效。例如:“Arial,sans-serif”。 |
设置文本对齐方式