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

这里写目录标题

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)
相关推荐
zhangrelay43 分钟前
机械臂末端规划智能模型的误区演示
linux·笔记·学习·ubuntu·ros2
织码weavecodes2 小时前
培训平台部署备份与容灾:从三服务交付到可恢复运行
大数据·学习·开源软件
SHARK_pssm2 小时前
【C++——类和对象(下)】
开发语言·c++·经验分享·笔记
JWASX4 小时前
Java 转 go 学习 - 类型转换
学习·golang
Ztt6666666664 小时前
壶口敞开以后,器身反而更显从容
笔记·其他·百度·微信公众平台·微信开放平台
小淮AI6 小时前
在职医生备考主治医师,我的资料搭配思路
学习
知产xiao_xin6 小时前
了解商号权
经验分享·笔记·知识产权
进击的横打7 小时前
【人工智能】卡片笔记法:从原子化思考到知识网络构建
笔记
AOI小白新手上路7 小时前
韦东山《ARM 架构与编程》基于I.MX6ULL 3-1 硬件知识_LED 原理图 · 学习笔记
arm开发·学习·架构
传奇开心果编程8 小时前
【现代声明式UI学与练】第1课 从命令式UI到声明式UI
学习·flutter·ui·swiftui·react·android jetpack