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

这里写目录标题

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)
相关推荐
im_AMBER2 分钟前
算法笔记 16 二分搜索算法
c++·笔记·学习·算法
摇滚侠3 分钟前
2025最新 SpringCloud 教程,Nacos-总结,笔记19
java·笔记·spring cloud
赵文宇(温玉)7 分钟前
不翻墙,基于Rancher极速启动Kubernetes,配置SSO登录,在线环境开放学习体验
学习·kubernetes·rancher
在逃热干面7 分钟前
(笔记)获取终端输出保存到文件
java·笔记·spring
leoufung9 分钟前
逆波兰表达式 LeetCode 题解及相关思路笔记
linux·笔记·leetcode
lingggggaaaa2 小时前
免杀对抗——C2远控篇&PowerShell&有无文件落地&C#参数调用&绕AMSI&ETW&去混淆特征
c语言·开发语言·笔记·学习·安全·microsoft·c#
lxmyzzs2 小时前
作为一名工程师,何不试试瑞芯微?
笔记·rk3588
wgego3 小时前
polarctf-web做题笔记
笔记·web安全
wdfk_prog4 小时前
[Linux]学习笔记系列 -- [kernel]workqueue
linux·笔记·学习
wdfk_prog4 小时前
[Linux]学习笔记系列 -- [kernel]usermode_helper
linux·笔记·学习