W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
沿水平方向布局容器。
該組件從API Version 7開始支持。后續(xù)版本如有新增內(nèi)容,則采用上角標(biāo)單獨標(biāo)記該內(nèi)容的起始版本。
Row(value?:{space?: number | string })
從API version 9開始,該接口支持在ArkTS卡片中使用。
參數(shù):
參數(shù)名 | 參數(shù)類型 | 必填 | 參數(shù)描述 |
---|---|---|---|
space | string | number | 否 | 橫向布局元素間距。 從API version 9開始,space為負(fù)數(shù)或者justifyContent設(shè)置為FlexAlign.SpaceBetween、FlexAlign.SpaceAround、FlexAlign.SpaceEvenly時不生效。 默認(rèn)值:0,單位vp 說明: 可選值為大于等于0的數(shù)字,或者可以轉(zhuǎn)換為數(shù)字的字符串。 |
名稱 | 參數(shù)類型 | 描述 |
---|---|---|
alignItems | 設(shè)置子組件在垂直方向上的對齊格式。 默認(rèn)值:VerticalAlign.Center 從API version 9開始,該接口支持在ArkTS卡片中使用。 | |
justifyContent8+ | 設(shè)置子組件在水平方向上的對齊格式。 默認(rèn)值:FlexAlign.Start 從API version 9開始,該接口支持在ArkTS卡片中使用。 |
- // 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%')
- }
- }
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: