<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      HarmonyOS ArkTS組件 | Flex 以彈性方式布局子組件的容器組件 學習記錄

      HarmonyOS ArkTS組件 | Flex 以彈性方式布局子組件的容器組件 學習記錄

      前言:最近需要用到彈性布局,記錄一下。(忽略圖片水印QAQ)

      說明:

      1. Flex組件在渲染時存在二次布局過程,因此在對性能有嚴格要求的場景下建議使用Column、Row代替。
      2. Flex組件主軸默認不設置時撐滿父容器,Column、Row組件主軸不設置時默認是跟隨子節點大小。

      接口:

      Flex(value?: { direction?: FlexDirection, wrap?: FlexWrap, justifyContent?: FlexAlign, alignItems?: ItemAlign, alignContent?: FlexAlign })
      

      參數:

      direction:
      子組件在Flex容器上排列的方向,即主軸的方向。

      // xxx.ets
      @Entry
      @Component
      struct FlexExample1 {
        build() {
          Column() {
            Column({ space: 5 }) {
              Text('direction:Row').fontSize(9).fontColor(0xCCCCCC).width('90%')
              Flex({ direction: FlexDirection.Row }) {
                Text('1').width('20%').height(50).backgroundColor(0xF5DEB3)
                Text('2').width('20%').height(50).backgroundColor(0xD2B48C)
                Text('3').width('20%').height(50).backgroundColor(0xF5DEB3)
                Text('4').width('20%').height(50).backgroundColor(0xD2B48C)
              }
              .height(70)
              .width('90%')
              .padding(10)
              .backgroundColor(0xAFEEEE)
      
              Text('direction:RowReverse').fontSize(9).fontColor(0xCCCCCC).width('90%')
              Flex({ direction: FlexDirection.RowReverse }) {
                Text('1').width('20%').height(50).backgroundColor(0xF5DEB3)
                Text('2').width('20%').height(50).backgroundColor(0xD2B48C)
                Text('3').width('20%').height(50).backgroundColor(0xF5DEB3)
                Text('4').width('20%').height(50).backgroundColor(0xD2B48C)
              }
              .height(70)
              .width('90%')
              .padding(10)
              .backgroundColor(0xAFEEEE)
      
              Text('direction:Column').fontSize(9).fontColor(0xCCCCCC).width('90%')
              Flex({ direction: FlexDirection.Column }) {
                Text('1').width('100%').height(40).backgroundColor(0xF5DEB3)
                Text('2').width('100%').height(40).backgroundColor(0xD2B48C)
                Text('3').width('100%').height(40).backgroundColor(0xF5DEB3)
                Text('4').width('100%').height(40).backgroundColor(0xD2B48C)
              }
              .height(160)
              .width('90%')
              .padding(10)
              .backgroundColor(0xAFEEEE)
      
              Text('direction:ColumnReverse').fontSize(9).fontColor(0xCCCCCC).width('90%')
              Flex({ direction: FlexDirection.ColumnReverse }) {
                Text('1').width('100%').height(40).backgroundColor(0xF5DEB3)
                Text('2').width('100%').height(40).backgroundColor(0xD2B48C)
                Text('3').width('100%').height(40).backgroundColor(0xF5DEB3)
                Text('4').width('100%').height(40).backgroundColor(0xD2B48C)
              }
              .height(160)
              .width('90%')
              .padding(10)
              .backgroundColor(0xAFEEEE)
            }.width('100%').margin({ top: 5 })
          }.width('100%')
        }
      }
      

      運行結果:

      wrap:
      Flex容器是單行/列還是多行/列排列。
      說明:
      在多行布局時,通過交叉軸方向,確認新行堆疊方向。

      // xxx.ets
      @Entry
      @Component
      struct FlexExample2 {
        build() {
          Column() {
            Column({ space: 5 }) {
              Text('Wrap').fontSize(9).fontColor(0xCCCCCC).width('90%')
              Flex({ wrap: FlexWrap.Wrap }) {
                Text('1').width('50%').height(50).backgroundColor(0xF5DEB3)
                Text('2').width('50%').height(50).backgroundColor(0xD2B48C)
                Text('3').width('50%').height(50).backgroundColor(0xD2B48C)
              }
              .width('90%')
              .padding(10)
              .backgroundColor(0xAFEEEE)
      
              Text('NoWrap').fontSize(9).fontColor(0xCCCCCC).width('90%')
              Flex({ wrap: FlexWrap.NoWrap }) {
                Text('1').width('50%').height(50).backgroundColor(0xF5DEB3)
                Text('2').width('50%').height(50).backgroundColor(0xD2B48C)
                Text('3').width('50%').height(50).backgroundColor(0xF5DEB3)
              }
              .width('90%')
              .padding(10)
              .backgroundColor(0xAFEEEE)
      
              Text('WrapReverse').fontSize(9).fontColor(0xCCCCCC).width('90%')
              Flex({ wrap: FlexWrap.WrapReverse , direction:FlexDirection.Row }) {
                Text('1').width('50%').height(50).backgroundColor(0xF5DEB3)
                Text('2').width('50%').height(50).backgroundColor(0xD2B48C)
                Text('3').width('50%').height(50).backgroundColor(0xD2B48C)
              }
              .width('90%')
              .height(120)
              .padding(10)
              .backgroundColor(0xAFEEEE)
            }.width('100%').margin({ top: 5 })
          }.width('100%')
        }
      }
      

      運行結果:

      justifyContent:
      子組件在Flex容器主軸上的對齊格式。

      // xxx.ets
      @Component
      struct JustifyContentFlex {
        justifyContent : number
      
        build() {
          Flex({ justifyContent: this.justifyContent }) {
            Text('1').width('20%').height(50).backgroundColor(0xF5DEB3)
            Text('2').width('20%').height(50).backgroundColor(0xD2B48C)
            Text('3').width('20%').height(50).backgroundColor(0xF5DEB3)
          }
          .width('90%')
          .padding(10)
          .backgroundColor(0xAFEEEE)
        }
      }
      
      @Entry
      @Component
      struct FlexExample3 {
        build() {
          Column() {
            Column({ space: 5 }) {
              Text('justifyContent:Start').fontSize(9).fontColor(0xCCCCCC).width('90%')
              JustifyContentFlex({ justifyContent: FlexAlign.Start })
      
              Text('justifyContent:Center').fontSize(9).fontColor(0xCCCCCC).width('90%')
              JustifyContentFlex({ justifyContent: FlexAlign.Center })
      
              Text('justifyContent:End').fontSize(9).fontColor(0xCCCCCC).width('90%')
              JustifyContentFlex({ justifyContent: FlexAlign.End })
      
              Text('justifyContent:SpaceBetween').fontSize(9).fontColor(0xCCCCCC).width('90%')
              JustifyContentFlex({ justifyContent: FlexAlign.SpaceBetween })
      
              Text('justifyContent:SpaceAround').fontSize(9).fontColor(0xCCCCCC).width('90%')
              JustifyContentFlex({ justifyContent: FlexAlign.SpaceAround })
      
              Text('justifyContent:SpaceEvenly').fontSize(9).fontColor(0xCCCCCC).width('90%')
              JustifyContentFlex({ justifyContent: FlexAlign.SpaceEvenly })
            }.width('100%').margin({ top: 5 })
          }.width('100%')
        }
      }
      

      運行結果:

      alignItems:
      子組件在Flex容器交叉軸上的對齊格式。

      // xxx.ets
      @Component
      struct AlignItemsFlex {
        alignItems : number
      
        build() {
          Flex({ alignItems: this.alignItems }) {
            Text('1').width('33%').height(30).backgroundColor(0xF5DEB3)
            Text('2').width('33%').height(40).backgroundColor(0xD2B48C)
            Text('3').width('33%').height(50).backgroundColor(0xF5DEB3)
          }
          .size({width: '90%', height: 80})
          .padding(10)
          .backgroundColor(0xAFEEEE)
        }
      }
      
      @Entry
      @Component
      struct FlexExample4 {
        build() {
          Column() {
            Column({ space: 5 }) {
              Text('alignItems:Auto').fontSize(9).fontColor(0xCCCCCC).width('90%')
              AlignItemsFlex({ alignItems: ItemAlign.Auto })
      
              Text('alignItems:Start').fontSize(9).fontColor(0xCCCCCC).width('90%')
              AlignItemsFlex({ alignItems: ItemAlign.Start })
      
              Text('alignItems:Center').fontSize(9).fontColor(0xCCCCCC).width('90%')
              AlignItemsFlex({ alignItems: ItemAlign.Center })
      
              Text('alignItems:End').fontSize(9).fontColor(0xCCCCCC).width('90%')
              AlignItemsFlex({ alignItems: ItemAlign.End })
      
              Text('alignItems:Stretch').fontSize(9).fontColor(0xCCCCCC).width('90%')
              AlignItemsFlex({ alignItems: ItemAlign.Stretch })
      
              Text('alignItems:Baseline').fontSize(9).fontColor(0xCCCCCC).width('90%')
              AlignItemsFlex({ alignItems: ItemAlign.Baseline })
            }.width('100%').margin({ top: 5 })
          }.width('100%')
        }
      }
      

      運行結果:

      alignContent:
      交叉軸中有額外的空間時,多行內容的對齊方式。僅在wrap為Wrap或WrapReverse下生效。

      // xxx.ets
      @Component
      struct AlignContentFlex {
        alignContent: number
      
        build() {
          Flex({ wrap: FlexWrap.Wrap, alignContent: this.alignContent }) {
            Text('1').width('50%').height(20).backgroundColor(0xF5DEB3)
            Text('2').width('50%').height(20).backgroundColor(0xD2B48C)
            Text('3').width('50%').height(20).backgroundColor(0xD2B48C)
          }
          .size({ width: '90%', height: 90 })
          .padding(10)
          .backgroundColor(0xAFEEEE)
        }
      }
      
      @Entry
      @Component
      struct FlexExample5 {
        build() {
          Column() {
            Column({ space: 5 }) {
              Text('alignContent:Start').fontSize(9).fontColor(0xCCCCCC).width('90%')
              AlignContentFlex({ alignContent: FlexAlign.Start })
      
              Text('alignContent:Center').fontSize(9).fontColor(0xCCCCCC).width('90%')
              AlignContentFlex({ alignContent: FlexAlign.Center })
      
              Text('alignContent:End').fontSize(9).fontColor(0xCCCCCC).width('90%')
              AlignContentFlex({ alignContent: FlexAlign.End })
      
              Text('alignContent:SpaceBetween').fontSize(9).fontColor(0xCCCCCC).width('90%')
              AlignContentFlex({ alignContent: FlexAlign.SpaceBetween })
      
              Text('alignContent:SpaceAround').fontSize(9).fontColor(0xCCCCCC).width('90%')
              AlignContentFlex({ alignContent: FlexAlign.SpaceAround })
      
              Text('alignContent:SpaceEvenly').fontSize(9).fontColor(0xCCCCCC).width('90%')
              AlignContentFlex({ alignContent: FlexAlign.SpaceEvenly })
            }.width('100%').margin({ top: 5 })
          }.width('100%')
        }
      }
      

      運行結果:

      ———————————— 封裝線 ——————————————————

      posted @ 2024-06-09 14:48  JayHsu_蔚藍審斂法  閱讀(319)  評論(0)    收藏  舉報
      主站蜘蛛池模板: av日韩在线一区二区三区| 男女啪祼交视频| 亚洲精品综合网在线8050影院| 一区二区三区精品视频免费播放 | 精品一区二区三区不卡| 午夜大片免费男女爽爽影院| 高清国产av一区二区三区| 精品国产乱码久久久久夜深人妻 | 欧美xxxxhd高清| 无码综合天天久久综合网| 大新县| 亚洲国产中文在线有精品| 国产成人一区二区不卡| 亚洲AV美女在线播放啊| 国产亚洲精品一区二区无 | 国产精品高清一区二区三区| 国精产品一区一区三区mba下载 | 精品无码一区二区三区电影| 亚洲精品国产av成人网| 亚洲成年av天堂动漫网站| 亚洲精品成人综合色在线| 四虎库影成人在线播放| 国产精品视频一区不卡| 无码AV无码免费一区二区| 成在线人永久免费视频播放| 久操热在线视频免费观看| 欧美成人www免费全部网站| 天堂久久天堂av色综合| 久久精品国产99国产精品严洲 | 高清欧美性猛交xxxx黑人猛交| 成人国产精品一区二区不卡 | 日韩在线视频网| 国产精品午夜福利91| 成人精品一区二区三区四| 天堂中文在线资源| 亚洲中文字幕久久精品码| 日本黄页网站免费观看| 好男人社区影视在线WWW| 欧美奶涨边摸边做爰视频| 欧美最新精品videossexohd| 国产午夜精品无码一区二区|