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

这里写目录标题

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)
相关推荐
微露清风10 分钟前
系统性学习Linux-第六讲-Ext文件系统
linux·服务器·学习
泯仲20 分钟前
从零起步学习MySQL 第十章:深入了解B+树及B+树的性能优势
b树·学习·mysql
2501_9269783331 分钟前
AI在精神世界的意义--对存在模式的重新解构
经验分享·笔记·ai写作
做怪小疯子32 分钟前
Python 基础学习
开发语言·python·学习
爱倒腾的老唐1 小时前
1、万用表
笔记
runafterhit1 小时前
AI基础学习-基础概念汇总
人工智能·学习
中屹指纹浏览器2 小时前
2026多账号安全运营:指纹浏览器选型、部署与平台风控应对指南
经验分享·笔记
charlie1145141912 小时前
2026年IMX6ULL正点原子Alpha开发板学习方案——U-Boot完全移植概览:从官方源码到你的自制板,这条路有多远
linux·学习·嵌入式·uboot·嵌入式linux·工程实践·编程指南
盐焗西兰花2 小时前
鸿蒙学习实战之路-Share Kit系列(10/17)-目标应用接收分享(应用内处理)
学习·华为·harmonyos
高梦轩2 小时前
LNMP 环境部署笔记
linux·笔记