十八、组件-容器组件-column、row、flex

复制代码
@Entry
@Component
struct ColumExample {

  build() {
    Column({space:10}) {
      Column() {
        Column().width('50%').height(30).backgroundColor(Color.Blue)
        Column().width('60%').height(40).backgroundColor(Color.Brown)
      }
      .width('90%')
      .height(100)
      .border({width:1,color:Color.Red})
      .alignItems(HorizontalAlign.Start) //水平对齐
      .justifyContent(FlexAlign.SpaceEvenly) //垂直对齐


      Row() {
        Row().width('30%').height(30).backgroundColor(Color.Blue)
        Row().width('40%').height(40).backgroundColor(Color.Brown)
      }
      .width('90%')
      .height(100)
      .border({width:1,color:Color.Red})
      .alignItems(VerticalAlign.Center)
      .justifyContent(FlexAlign.Center)

      Flex({
        direction:FlexDirection.Row,
        justifyContent:FlexAlign.SpaceAround,
        alignItems:ItemAlign.Center,
        wrap:FlexWrap.WrapReverse,
        alignContent:FlexAlign.End
      }){
        Text('1').width('5%').height(50).backgroundColor(0xF5DEB3)
        Text('2').width('20%').height(60).backgroundColor(0xD2B48C)
        Text('3').width('30%').height(70).backgroundColor(0xF5DEB3)
        Text('4').width('15%').height(55).backgroundColor(0xD2B48C)
      }
      .height(160)
      .width('90%')
      .backgroundColor(0xAFEEEE)





    }
    .margin(20)
  }
}
复制代码

 

posted @   创客未来  阅读(54)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
历史上的今天:
2020-12-22 委托、事件、lambda表达式
点击右上角即可分享
微信分享提示