实现List嵌套功能鸿蒙示例代码

鸿蒙场景化示例代码技术工程师
发布于 2025-4-7 17:01
浏览
0收藏

本文原创发布在华为开发者社区

介绍

本示例展示了一个List嵌套Demo,其功能为List中嵌套List。

实现List嵌套功能源码链接

效果预览

实现List嵌套功能鸿蒙示例代码-鸿蒙开发者社区

使用说明

实现思路

List嵌套

List({ space: 5, initialIndex: 0 }) {
        ForEach(this.list02, (item: number) => {
          ListItem() {
            Text('二级嵌套内容: ' + item )
              .height(150)
              .width('100%')
              .fontSize(30)
              .backgroundColor(Color.Green)
          }
        }, (item: string) => item)
      }.listDirection(Axis.Vertical)
      .scrollBar(BarState.Off)
      .layoutWeight(1)
      .nestedScroll({
        scrollForward: NestedScrollMode.SELF_FIRST,
        scrollBackward: NestedScrollMode.SELF_FIRST
      })
})
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.

分类
收藏
回复
举报
回复
    相关推荐