【鸿蒙学习笔记】属性学习迭代笔记

这里写目录标题

Text

cpp 复制代码
@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

cpp 复制代码
Image($r('app.media.zhibo'))
  .width(96)
  .height(96)
  .borderRadius(12)
  .objectFit(ImageFit.Fill) // 不明

Column

cpp 复制代码
@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

cpp 复制代码
Row() {

}
.alignItems(VerticalAlign.Center)
相关推荐
楚山之石6 小时前
【Lancet】BRAID 随机试验:乳腺致密女性补充成像,abbreviated MRI 与 CEM 检出更多早期癌(首轮中期结果)
人工智能·科技·学习·mri·医学影像
饮水桶_T10 小时前
Java调用大语言模型 笔记
笔记·设计模式·电脑·ai编程
Sunflower_ac10 小时前
强化学习学习笔记:Lab 0–Lab 2
笔记·学习
JWIPC11 小时前
MyClaw 3.0 自动化数据采集实战指南
linux·运维·笔记·科技·深度学习·物联网·自动化
Brilliantwxx11 小时前
【项目】 智慧监测系统 开发笔记(三)界面切换、阀值保存、TB6612、联网、ESP8266机智云、语音控制、智能公元
笔记·stm32·单片机·嵌入式硬件
DeepCeLa12 小时前
PP阻燃笔记:稀土协效剂在膨胀阻燃体系里能起什么作用
笔记·稀土·稀土科技·稀土协效剂·pp应用
Z21-X14 小时前
云原生运维学习笔记:Kubernetes 自动扩缩容与资源管控实战
运维·笔记·学习·云原生·kubernetes
可涵不会debug15 小时前
ChatServer 模块学习笔记:HTTP 接入层、多线程与流式响应
笔记·学习·http
一只大鸽子19 小时前
游戏开发笔记12-像素画基础-细节
笔记