Button组件无法设置字体最大、最小值
2024-12-18 15:52:45
288次阅读
0个评论
Button组件的labelStyle可以设置Button组件label文本和字体的样式。示例代码如下:
@Entry
@Component
struct ButtonSetTheMaximumAndMinimumFontSizes {
@State text: string = 'hello';
@State widthShortSize: number = 300;
build() {
Row() {
Button(this.text)
.width(this.widthShortSize)
.height(100)
.labelStyle({
overflow: TextOverflow.Clip,
maxLines: 1,
minFontSize: 20,
maxFontSize: 40,
font: {
size: 30,
weight: FontWeight.Bolder,
family: 'cursive',
style: FontStyle.Italic
}
})
}
}
}
00
- 1回答
- 0粉丝
- 0关注
