Button('按钮设置背景颜色', { type: ButtonType.Normal })
.fontColor(Color.Black)
.backgroundColor(Color.Gray)
.margin({ top: 30 }); Button('按钮设置边框', { type: ButtonType.Normal })
.backgroundColor(Color.Gray)
.border({
width: 2,
color: Color.Blue
}); 完整代码示例:
@Entry
@Component
struct buttonTest {
build() {
Column({ space: 20 }) {
Button('按钮设置背景颜色', { type: ButtonType.Normal })
.fontColor(Color.Black)
.backgroundColor(Color.Gray)
.margin({ top: 30 });
Button('按钮设置边框', { type: ButtonType.Normal })
.backgroundColor(Color.Gray)
.border({
width: 2,
color: Color.Blue
});
}
.backgroundColor(Color.White)
.height('100%')
.width('100%');
}
}