Row
沿水平方向布局容器。
說明:
開發(fā)前請(qǐng)熟悉鴻蒙開發(fā)指導(dǎo)文檔 :[gitee.com/li-shizhen-skin/harmony-os/blob/master/README.md
]
該組件從API Version 7開始支持。后續(xù)版本如有新增內(nèi)容,則采用上角標(biāo)單獨(dú)標(biāo)記該內(nèi)容的起始版本。
子組件
可以包含子組件。
接口
Row(value?:{space?: number | string })
從API version 9開始,該接口支持在ArkTS卡片中使用。
參數(shù):
參數(shù)名 | 參數(shù)類型 | 必填 | 參數(shù)描述 |
---|---|---|---|
space | string | number | 否 |
屬性
除支持[通用屬性]外,還支持以下屬性:
名稱 | 參數(shù)類型 | 描述 |
---|---|---|
alignItems | [VerticalAlign] | 設(shè)置子組件在垂直方向上的對(duì)齊格式。 默認(rèn)值:VerticalAlign.Center 從API version 9開始,該接口支持在ArkTS卡片中使用。 |
justifyContent8+ | [FlexAlign] | 設(shè)置子組件在水平方向上的對(duì)齊格式。 默認(rèn)值:FlexAlign.Start 從API version 9開始,該接口支持在ArkTS卡片中使用。HarmonyOS與OpenHarmony鴻蒙文檔籽料:mau123789是v直接拿 |
說明:
Row布局時(shí)若子組件不設(shè)置flexShrink則默認(rèn)不會(huì)壓縮子組件,即所有子組件主軸大小累加可超過容器主軸。
事件
支持[通用事件]
示例
// xxx.ets
@Entry
@Component
struct RowExample {
build() {
Column({ space: 5 }) {
// 設(shè)置子組件水平方向的間距為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 })
// 設(shè)置子元素垂直方向?qū)R方式
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 })
// 設(shè)置子元素水平方向?qū)R方式
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%')
}
}
審核編輯 黃宇
-
組件
+關(guān)注
關(guān)注
1文章
532瀏覽量
18415 -
鴻蒙
+關(guān)注
關(guān)注
60文章
2617瀏覽量
44021
發(fā)布評(píng)論請(qǐng)先 登錄
【飛騰派4G版免費(fèi)試用】Stage鴻蒙應(yīng)用基礎(chǔ)
鴻蒙開發(fā)基礎(chǔ)-Web組件之cookie操作
鴻蒙入門實(shí)戰(zhàn)-ArkTS開發(fā)
鴻蒙NEXT-Column和Row組件的使用
鴻蒙ArkTS容器組件:Scroll
鴻蒙ArkTS容器組件:SideBarContainer

評(píng)論