#鸿蒙学习大百科#如何通过List组件的lanes属性适配不同尺寸的设备?

​如何通过List组件的lanes属性适配不同尺寸的设备?


HarmonyOS
2024-10-10 09:46:16
832浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
海底捞天王
@Entry
@Component
struct Index {
  @State list: string[] = new Array(10).fill("a")
  build() {
    Column() {
      List() {
        ForEach(this.list, (e: string) => {
          ListItem() {
            Text(e)
              .width("100%")
              .height(100)
              .textAlign(TextAlign.Center)
              .backgroundColor(Color.Yellow)
              .fontSize(20)
              .margin(10)
          }
        })
      }.lanes({minLength:200,maxLength:300})
    }.width("100%")
    .height("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-10-10 15:43:32


相关问题