Row
沿水平方向布局容器。
說明:
開發前請熟悉鴻蒙開發指導文檔 :[gitee.com/li-shizhen-skin/harmony-os/blob/master/README.md
]
該組件從API Version 7開始支持。后續版本如有新增內容,則采用上角標單獨標記該內容的起始版本。
子組件
可以包含子組件。
接口
Row(value?:{space?: number | string })
從API version 9開始,該接口支持在ArkTS卡片中使用。
參數:
參數名 | 參數類型 | 必填 | 參數描述 |
---|---|---|---|
space | string | number | 否 |
屬性
除支持[通用屬性]外,還支持以下屬性:
名稱 | 參數類型 | 描述 |
---|---|---|
alignItems | [VerticalAlign] | 設置子組件在垂直方向上的對齊格式。 默認值:VerticalAlign.Center 從API version 9開始,該接口支持在ArkTS卡片中使用。 |
justifyContent8+ | [FlexAlign] | 設置子組件在水平方向上的對齊格式。 默認值:FlexAlign.Start 從API version 9開始,該接口支持在ArkTS卡片中使用。HarmonyOS與OpenHarmony鴻蒙文檔籽料:mau123789是v直接拿 |
說明:
Row布局時若子組件不設置flexShrink則默認不會壓縮子組件,即所有子組件主軸大小累加可超過容器主軸。
事件
支持[通用事件]
示例
// xxx.ets
@Entry
@Component
struct RowExample {
build() {
Column({ space: 5 }) {
// 設置子組件水平方向的間距為5
Text('space').width('90%')
Row({ space: 5 }) {
Row().width('30%').height(50).backgroundColor(0xAFEEEE)
Row().width('30%').height(50).backgroundColor(0x00FFFF)
}.width('90%').height(107).border({ width: 1 })
// 設置子元素垂直方向對齊方式
Text('alignItems(Bottom)').width('90%')
Row() {
Row().width('30%').height(50).backgroundColor(0xAFEEEE)
Row().width('30%').height(50).backgroundColor(0x00FFFF)
}.width('90%').alignItems(VerticalAlign.Bottom).height('15%').border({ width: 1 })
Text('alignItems(Center)').width('90%')
Row() {
Row().width('30%').height(50).backgroundColor(0xAFEEEE)
Row().width('30%').height(50).backgroundColor(0x00FFFF)
}.width('90%').alignItems(VerticalAlign.Center).height('15%').border({ width: 1 })
// 設置子元素水平方向對齊方式
Text('justifyContent(End)').width('90%')
Row() {
Row().width('30%').height(50).backgroundColor(0xAFEEEE)
Row().width('30%').height(50).backgroundColor(0x00FFFF)
}.width('90%').border({ width: 1 }).justifyContent(FlexAlign.End)
Text('justifyContent(Center)').width('90%')
Row() {
Row().width('30%').height(50).backgroundColor(0xAFEEEE)
Row().width('30%').height(50).backgroundColor(0x00FFFF)
}.width('90%').border({ width: 1 }).justifyContent(FlexAlign.Center)
}.width('100%')
}
}
審核編輯 黃宇
聲明:本文內容及配圖由入駐作者撰寫或者入駐合作網站授權轉載。文章觀點僅代表作者本人,不代表電子發燒友網立場。文章及其配圖僅供工程師學習之用,如有內容侵權或者其他違規問題,請聯系本站處理。
舉報投訴
-
組件
+關注
關注
1文章
530瀏覽量
18322 -
鴻蒙
+關注
關注
59文章
2535瀏覽量
43806
發布評論請先 登錄
相關推薦
熱點推薦
鴻蒙開發基礎-Web組件之cookie操作
})
...
}
...
本文章主要是對鴻蒙開發當中ArkTS語言的基礎應用實戰,Web組件里的cookie操作。更多的鴻蒙應用開發技術,可以前往我的主頁學習更多,下面是一張
發表于 01-14 21:31
評論