鸿蒙(HarmonyOS)项目方舟框架(ArkUI)之线性布局容器Row组件

鸿蒙(HarmonyOS)项目方舟框架(ArkUI)之线性布局容器Row组件

一、操作环境

操作系统: Windows 10 专业版、IDE:DevEco Studio 3.1、SDK:HarmonyOS 3.1

二、Row组件

沿水平方向布局容器。

子组件

可以包含子组件。

接口

Row(value?:{space?: string | number})

参数
参数名 参数类型 必填 默认值 参数描述
space string | number 0 横向布局元素间距。
属性
名称 参数类型 默认值 描述
alignItems VerticalAlign VerticalAlign.Center 在垂直方向上子组件的对齐格式。
justifyContent8+ FlexAlign FlexAlign.Start 设置子组件在水平方向上的对齐格式。

三、示例

代码
复制代码
// xxx.ets
@Entry
@Component
struct RowExample {
  build() {
    Column({ space: 5 }) {
      Text('space').fontSize(9).fontColor(0xCCCCCC).width('90%')
      Row({ space: 5 }) {
        Row().width('30%').height(50).backgroundColor("#FF1493")
        Row().width('30%').height(50).backgroundColor(0x00FFFF)
      }.width('90%').height(107).border({ width: 1 })

      Text('alignItems(Top)').fontSize(9).fontColor(0xCCCCCC).width('90%')
      Row() {
        Row().width('30%').height(50).backgroundColor("#FF1493")
        Row().width('30%').height(50).backgroundColor(0x00FFFF)
      }.alignItems(VerticalAlign.Top).height('15%').border({ width: 1 })

      Text('alignItems(Center)').fontSize(9).fontColor(0xCCCCCC).width('90%')
      Row() {
        Row().width('30%').height(50).backgroundColor("#FF1493")
        Row().width('30%').height(50).backgroundColor(0x00FFFF)
      }.alignItems(VerticalAlign.Center).height('15%').border({ width: 1 })

      Text('justifyContent(End)').fontSize(9).fontColor(0xCCCCCC).width('90%')
      Row() {
        Row().width('30%').height(50).backgroundColor("#FF1493")
        Row().width('30%').height(50).backgroundColor(0x00FFFF)
      }.width('90%').border({ width: 1 }).justifyContent(FlexAlign.End)

      Text('justifyContent(Center)').fontSize(9).fontColor(0xCCCCCC).width('90%')
      Row() {
        Row().width('30%').height(50).backgroundColor("#FF1493")
        Row().width('30%').height(50).backgroundColor(0x00FFFF)
      }.width('90%').border({ width: 1 }).justifyContent(FlexAlign.Center)
    }.width('100%')
  }
}
图片

你有时间常去我家看看我在这里谢谢你啦...

我家地址:亚丁号

最后送大家一首诗:

山高路远坑深,

大军纵横驰奔,

谁敢横刀立马?

惟有点赞加关注大军。

相关推荐
小风呼呼吹儿13 小时前
Flutter 框架跨平台鸿蒙开发 - 家庭用药清单:智能管理家庭药品
flutter·华为·harmonyos
纯爱掌门人13 小时前
鸿蒙端云一体化开发(二):云数据库
数据库·华为·harmonyos·端云一体化
小雨青年13 小时前
【鸿蒙原生开发会议随记 Pro】 数据存储架构 RelationalStore 在复杂资产管理中的应用
华为·架构·harmonyos
djarmy15 小时前
跨平台Flutter 开源鸿蒙开发指南(三):使用thirdParty的dio库实现网络请求 示例
flutter·华为·harmonyos
Miguo94well16 小时前
Flutter框架跨平台鸿蒙开发——护眼提醒APP的开发流程
flutter·华为·harmonyos·鸿蒙
zilikew17 小时前
Flutter框架跨平台鸿蒙开发——拼图游戏的开发流程
flutter·华为·harmonyos·鸿蒙
Easonmax18 小时前
基础入门 React Native 鸿蒙跨平台开发:帮助中心页面完整实现(常见问题+搜索+分类)
react native·react.js·harmonyos
猛扇赵四那边好嘴.19 小时前
Flutter 框架跨平台鸿蒙开发 - 手工皮具制作记录:打造专业级皮具制作管理工具
flutter·华为·harmonyos
猛扇赵四那边好嘴.19 小时前
Flutter 框架跨平台鸿蒙开发 - 免费电子书下载器:智能搜索与离线阅读
flutter·华为·harmonyos
小风呼呼吹儿19 小时前
Flutter 框架跨平台鸿蒙开发 - 随机点名器:打造课堂互动神器
flutter·华为·harmonyos