thecr0w
thecr0w

Reputation: 2197

How to implement wrap_content in ArkTs of HarmonyOS?

How to implement wrap_content in ArkTs of HarmonyOS? It seems that all view component must be fixed width and height. Can I implement this in TypeScript? As ArkTs is another kind of TypeScript. Thanks

@doc https://developer.huawei.com/consumer/en/doc/harmonyos-guides-V2/1_2learning-arkts-0000001493895336-V2

      RelativeContainer() {

        Image($r('app.media.bg_plan_list'))
          .width('100%')
          .alignRules(AlignVtHc)
          .id("row1")
          .backgroundColor('#33330000')

      }
      .width('100%')
      .height(450)
      .border(BWC)
      .margin(Mleft)
      .backgroundColor('#33330000')


let AlignVtHc:Record<string,Record<string,string|VerticalAlign|HorizontalAlign>> = {
  'top': { 'anchor': '__container__', 'align': VerticalAlign.Top },
  'left': { 'anchor': '__container__', 'align': HorizontalAlign.Start }
}
let Mleft:Record<string,number> = { 'left': 16, 'right': 16, 'top': 0, 'bottom': 0 }
let BWC:Record<string,number|string> = { 'width': 2, 'color': '#6699FF' }

Upvotes: 0

Views: 131

Answers (0)

Related Questions