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

鸿蒙学习笔记01

width(‘100%’)可以通过这样实现百分比

1.反引号  英文输入法状态下  ESC底下 直接可以打出

反引号下是可以进行转义的

2.向外导出 俩种方式  按需和默认

import { MeiTuanHeader } from '../views/MeiTuanHeader';
import MeiTuanMain from '../views/MeiTuanMain';

3.线性布局   内容超出不会有滚动条

Column  从上往下 垂直排列 水平居中

Row 从左往右 垂直排列 水平居中

4

justifyContent(FlexAlign.Center)设置内部内容的   类似绝对布局

5.

@Entry
@Component
struct TestPage {@State message: string = 'Hello World';build() {Column() {Row() {Text("首页").fontColor(Color.White).fontSize(40)}.height(100).backgroundColor(Color.Red).width("100%").justifyContent(FlexAlign.Center)Column() {Text("我是有底线的").fontColor(Color.Red).fontSize(30).fontWeight(FontWeight.Bold)}.backgroundColor(Color.White).layoutWeight(1).width("100%").justifyContent(FlexAlign.End)// Row() {//   //方法1//   Text("")//     .width(60)//     .height(40)//     .backgroundColor(Color.White)//     .layoutWeight(1)//     .margin(10)//   Text("")//     .width(60)//     .height(40)//     .backgroundColor(Color.White)//     .layoutWeight(1)//     .margin(10)//   Text("")//     .width(60)//     .height(40)//     .backgroundColor(Color.White)//     .layoutWeight(1)//     .margin(10)//// }.width("100%").height(100).backgroundColor(Color.Red)//方法2Row({ space: 10 }) {Text("").width(80).height(40).backgroundColor(Color.White)Text("").width(80).height(40).backgroundColor(Color.White)Text("").width(80).height(40).backgroundColor(Color.White)}.width("100%").height(100).backgroundColor(Color.Red).justifyContent(FlexAlign.Center)}.width("100%").height("100%")}
}

两种方法

 6.侧轴的相对布局 类似

alignSelf(ItemAlign.)

7.justifyContent()的不同效果

用ROW 和 Column 同时包裹布局 就会内居中

 Row() {Column() {}.width("100%")}.height("100%")

第三个效果为流式布局

Flex布局 可以在布局超出的时候换行 重新排  但是重排重绘 对性能影响比较大 主要是重排

{}里边一般是放参数 

相关文章:

  • 第三章支线三 ·异步幻境 · 时间之缝的挑战
  • Redis 知识点一
  • 进程优先级
  • Spring注解开发
  • 原型对象(Prototype)详解
  • 二叉树-226.翻转链表-力扣(LeetCode)
  • Argo CD 入门 - 安装与第一个应用的声明式同步
  • OC—UI学习-2
  • 全志v853跑通rtsp sample
  • 阿里云Alibaba Cloud安装Docker与Docker compose【图文教程】
  • 创新滑模观测器设计:改进趋近律与切换函数的永磁同步电机无传感器控制
  • 65、.NET 中DllImport的用途
  • React、Git、计网、发展趋势等内容——前端面试宝典(字节、小红书和美团)
  • Python环境搭建:pyenv-win的使用指南
  • leetcode56-合并区间
  • 如何将淘宝店铺商品搬到抖店去?利用 API 实现淘宝店铺商品到抖店的高效迁移
  • 分库分表的取舍
  • 机器学习算法_决策树
  • 【Java学习笔记】BigInteger 和 BigDecimal 类
  • Windows开机自动启动中间件
  • wordpress怎么代码高亮/小红书关键词排名优化
  • 武安企业做网站推广/北京百度搜索优化
  • wordpress 菜单跳转/1688关键词怎么优化
  • 奥鹏作业代做靠谱的网站/软文的本质是什么
  • 做美食网站的图片/网址申请注册
  • 网站模板 扁平化/淘宝运营培训课程