当前位置: 首页 > news >正文

【鸿蒙学习笔记】位置设置

官方文档:位置设置

目录标题

  • align:子元素的对齐方式
  • direction:官方文档没懂,看图理解吧

align:子元素的对齐方式

Stack() {Text('TopStart')}.width('90%').height(50).backgroundColor(0xFFE4C4).align(Alignment.TopStart)
Stack() {Text('Top')}.width('90%').height(50).backgroundColor(0xFFE4C4).align(Alignment.Top)
Stack() {Text('TopEnd')}.width('90%').height(50).backgroundColor(0xFFE4C4).align(Alignment.TopEnd)
Stack() {Text('Start')}.width('90%').height(50).backgroundColor(0xFFE4C4).align(Alignment.Start)
Stack() {Text('Center')}.width('90%').height(50).backgroundColor(0xFFE4C4).align(Alignment.Center)
Stack() {Text('End')}.width('90%').height(50).backgroundColor(0xFFE4C4).align(Alignment.End)
Stack() {Text('BottomStart')}.width('90%').height(50).backgroundColor(0xFFE4C4).align(Alignment.BottomStart)
Stack() {Text('Bottom')}.width('90%').height(50).backgroundColor(0xFFE4C4).align(Alignment.Bottom)
Stack() {Text('BottomEnd')}.width('90%').height(50).backgroundColor(0xFFE4C4).align(Alignment.BottomEnd)

在这里插入图片描述

direction:官方文档没懂,看图理解吧

Row() {Text('1').height(50).width('25%').fontSize(16).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)Text('2').height(50).width('25%').fontSize(16).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)Text('3').height(50).width('25%').fontSize(16).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)Text('4').height(50).width('25%').fontSize(16).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
}.width('90%').direction(Direction.Ltr)
Row() {Text('1').height(50).width('25%').fontSize(16).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)Text('2').height(50).width('25%').fontSize(16).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)Text('3').height(50).width('25%').fontSize(16).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)Text('4').height(50).width('25%').fontSize(16).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
}.width('90%').direction(Direction.Rtl)
Row() {Text('1').height(50).width('25%').fontSize(16).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)Text('2').height(50).width('25%').fontSize(16).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)Text('3').height(50).width('25%').fontSize(16).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)Text('4').height(50).width('25%').fontSize(16).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
}.width('90%').direction(Direction.Auto)

在这里插入图片描述

http://www.lryc.cn/news/387426.html

相关文章:

  • 41.HOOK引擎设计原理
  • STM32启动流程 和 map文件的作用
  • 深度解析华为仓颉语言
  • Android简介-历史、API等级与体系结构
  • SpringBoot:使用Spring Batch实现批处理任务
  • 用JQueryUI库在.net MVC中配置datepicker(时间日期控件)
  • 算法:链表
  • Redis基础教程(一):redis配置
  • 短视频矩阵系统:打造品牌影响力的新方式
  • 品牌推广的三个阶段与核心内容,一篇文章全掌握!
  • 队列与循环队列
  • python基础问题记录
  • Qt之饼图(Pie Graph)
  • Java项目Git提交规范
  • flink-触发器Trigger和移除器Evictor
  • 【力扣 28】找出字符串中第一个匹配项的下标 C++题解(字符串匹配)
  • 软件构造 | Design Patterns for Reuse and Maintainability
  • Python数据分析-股票分析和可视化(深证指数)
  • Linux如何安装openjdk1.8
  • 【LLVM】LTO学习
  • 事务的特性-原子性(Atomicity)、一致性(Consistency)、隔离性(Asolation)、持久性(Durability)
  • redis哨兵模式(Redis Sentinel)
  • 【牛客】牛客小白月赛97 题解 A - E
  • Spring Boot中泛型参数的灵活运用:最佳实践与性能优化
  • MySQL建表时的注意事项
  • Advanced RAG 09:『提示词压缩』技术综述
  • (13)DroneCAN 适配器节点(二)
  • 摸鱼大数据——Spark基础——Spark环境安装——Spark Local[*]搭建
  • 函数内部结构分层浅析(从MVC分层架构联想)
  • 【three.js案例二】时空隧道