HarmonyOS相对布局问题

Stack容器中有两个Row. A_Row是宽高和Stack一样的. B_Row的高比Stack小20. 应该怎么去设置高度 ?

HarmonyOS
2024-08-08 12:04:52
1.0w浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
superinsect

可以分别给Stack容器和两个Row容器设置height高度。

Stack(){ 
  Row(){}.height(500) 
  Row(){}.height(480) 
}.height(500)
  • 1.
  • 2.
  • 3.
  • 4.

可以参考以下代码:

@Entry 
@Component 
struct Index { 
  @State message: string = 'Hello World'; 
  build() { 
    Column() { 
      Stack({ alignContent: Alignment.Bottom }) { 
        Row() { 
        }.height('100%') 
        .width('100%') 
        .backgroundColor(Color.Yellow) 
        Row() { 
        }.width('100%') 
        .height('calc(100% - 60vp)') 
        .backgroundColor(Color.Brown) 
        .zIndex(2) 
      }.height('100%') 
      .width(200) 
      .backgroundColor(Color.Pink) 
    }.height(200) 
    .width('100%') 
  } 
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
分享
微博
QQ
微信
回复
2024-08-08 19:57:05


相关问题
HarmonyOS 相对布局的高度问题
806浏览 • 1回复 待解决
HarmonyOS 文字和图片相对布局问题
602浏览 • 1回复 待解决
相对布局(RelativeContainer)
2086浏览 • 1回复 待解决
HarmonyOS 布局问题
681浏览 • 1回复 待解决
HarmonyOS UI布局问题
1252浏览 • 1回复 待解决
HarmonyOS 网格式布局问题
563浏览 • 1回复 待解决
HarmonyOS Flex 布局设置问题
1436浏览 • 1回复 待解决
HarmonyOS 布局尺寸的问题
813浏览 • 1回复 待解决
HarmonyOS UI布局水平居中问题
904浏览 • 1回复 待解决
HarmonyOS scroll 内控件布局问题
1100浏览 • 1回复 待解决
HarmonyOS 横屏后布局问题
1320浏览 • 1回复 待解决