HarmonyOS RelativeContainer无法根据子组件的高度,自适配自己的高度?

RelativeContainer无法根据子组件的高度,自适配自己的高度,详细代码

@Entry
@Component
export struct RelativeContainerDemo {
  build() {
    Column() {

      RelativeContainer() {

        Column() {
          Text('13241234')
            .fontColor('#333')

          Text('234234234')
            .fontColor('#333')
        }
        .alignRules({
          left: {anchor: "__container__", align: HorizontalAlign.Start},
          top: {anchor: "__container__", align: VerticalAlign.Top}
        })
        .id("Column2")

      }
      .width("auto").height("auto")
      .backgroundColor(Color.Red)

      Row().width('100%').height(40).backgroundColor(Color.Yellow)
    }
    .backgroundColor(Color.White)
    .width('100%').height('100%')
  }
}
阅读 452
1 个回答