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

这里写目录标题

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)
相关推荐
宵时待雨14 小时前
C语言笔记归纳20:文件操作
c语言·开发语言·笔记·算法
炽烈小老头21 小时前
【每天学习一点算法 2025/12/19】二叉树的层序遍历
数据结构·学习·算法
xian_wwq21 小时前
【学习笔记】数据血缘
笔记·学习·数据血缘
日更嵌入式的打工仔1 天前
实用:嵌入式执行时间测量常用方法
笔记·单片机
map_vis_3d1 天前
JSAPIThree LODModel 性能优化学习笔记:细节层次模型加载
笔记·学习·3d
MarkHD1 天前
智能体在车联网中的应用:第9天 核心工具链与仿真世界:SUMO交通仿真入门——从安装到构建你的第一个虚拟十字路口
学习
lxh01131 天前
2025/12/18 学习总结
学习
im_AMBER1 天前
数据结构 13 图 | 哈希表 | 树
数据结构·笔记·学习·算法·散列表
会思考的猴子1 天前
UE5 笔记敌人自动追踪
笔记·ue5
wdfk_prog1 天前
[Linux]学习笔记系列 -- [fs][drop_caches]
linux·笔记·学习