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

这里写目录标题

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)
相关推荐
YCY^v^11 分钟前
PSW、PFW、SPSW、SPFW 是信捷TouchWin
学习
Engineer邓祥浩1 小时前
JVM学习笔记(13) 第五部分 高效并发 第12章 Java内存模型与线程
jvm·笔记·学习
我命由我123451 小时前
程序员的心理学学习笔记 - 反刍思维
经验分享·笔记·学习·职场和发展·求职招聘·职场发展·学习方法
GISer_Jing1 小时前
AI知识学习
人工智能·redis·学习
星辰_mya1 小时前
PV之系统与并发的核心wu器
java·开发语言·后端·学习·面试·架构师
暗夜猎手-大魔王1 小时前
learn-claude-code项目学习总结
学习
热爱生活的五柒3 小时前
度量学习-Radar Signal Deinterleaving Using Transformer Encoder and HDBSCAN 论文解析
深度学习·学习·transformer
xuhaoyu_cpp_java4 小时前
事务学习(一)
数据库·经验分享·笔记·学习·mysql
代码地平线4 小时前
OpenCode零基础教程完整版
笔记
nashane4 小时前
HarmonyOS 6学习:音频焦点管理实战——解决应用打开中断听书功能的技术指南
学习·音视频·harmonyos·harmonyos 5