Text
@Entry
@Component
struct PracExample {
build() {
Row() {
Text('文本描述')
.fontSize(40)
.fontWeight(FontWeight.Bold)
.fontColor(Color.Blue)
.backgroundColor(Color.Red)
.width('50%')
.height("50")
.size({ width: '80%', height: '70' })
.borderRadius(20)
.border({ width: 3, style: BorderStyle.Dashed })
.margin(40)
.padding(15)
.textAlign(TextAlign.Center)
.opacity(0.7)
}.backgroundColor(Color.Yellow)
}
}
Image
Image($r('app.media.zhibo'))
.width(96)
.height(96)
.borderRadius(12)
.objectFit(ImageFit.Fill)
Column
@Entry
@Component
struct PracExample {
build() {
Column({ space: 10 }) {
Text('文本描述').size({ width: '80%', height: '60' }).backgroundColor(Color.Red)
}
.width('100%')
.height(150)
.backgroundColor(Color.Pink)
.border({ radius: { topLeft: 15, topRight: 15, } })
.borderRadius(12)
.margin(20)
.padding(10)
.alignItems(HorizontalAlign.Start)
.justifyContent(FlexAlign.Center)
}
}
Row
Row() {
}
.alignItems(VerticalAlign.Center)