interface IListLayout {
    align: AlignType;
    columnGap: number;
    columns: number;
    contentHeight: number;
    contentWidth: number;
    foldInvisibles: boolean;
    itemSize: Point;
    minChildSize: number;
    numItems: number;
    padding: number[];
    pageMode: boolean;
    rowGap: number;
    rows: number;
    get stretchParamsX(): StretchParam[];
    get stretchParamsY(): StretchParam[];
    stretchX: StretchMode;
    stretchY: StretchMode;
    type: LayoutType;
    valign: VAlignType;
    viewHeight: number;
    viewWidth: number;
    childIndexToItemIndex(index: number): number;
    getRectByItemIndex(index: number): Rectangle;
    getSnappingPosition(xValue: number, yValue: number, xDir: number, yDir: number, resultPoint?: Point): Point;
    itemIndexToChildIndex(index: number): number;
    refresh(force?: boolean): void;
    refreshVirtualList(): void;
    resizeToFit(childCount?: number, minSize?: number): void;
    setChangedFlag(reason?: LayoutChangedReason): void;
}

层级 (查看完整内容)

访问器

  • get columns(): number
  • 返回 number

    This option is only effective for FlowX layout type. If set to a value greater than 0, a new row will only be started when the number of items in each row reaches the specified value.

    这个选项只对FlowX布局类型布局有效。如果设置了大于0的值,则每行的数量到达设定的值才会开启新的一行。

  • set columns(value): void
  • 参数

    • value: number

    返回 void

  • get foldInvisibles(): boolean
  • 返回 boolean

    If set to true, when an item is not visible (visible=false), it will not reserve space for it during layout, meaning the layout will ignore this item; if unchecked, it will reserve space for this item, resulting in a blank placeholder.

    如果设置为true,当某个item不可见时(visible=false),布局时不会为他留位置,也就是排版时会忽略这个item;如果不勾选,则会为这个item保留位置,显示效果就是一个空白的占位。

  • set foldInvisibles(value): void
  • 参数

    • value: boolean

    返回 void

  • get minChildSize(): number
  • 返回 number

    The minimum size for child nodes. When automatically adjusting the size of child nodes based on layout parameters, it will not be smaller than this value. For example, if set to 30 and a node requires a width of 10 during layout, the final width of the node will be set to 30.

    当根据布局参数自动改变子节点的大小时,不会小于这里设置的值。例如,如果这里设置了30,并且一个节点在排列时要求宽度为10,则节点最后的宽度会被设置为30。

  • set minChildSize(value): void
  • 参数

    • value: number

    返回 void

  • get numItems(): number
  • 返回 number

    Set the list item count. If the list is not virtual, specified number of items will be created. If the list is virtual, only items in view will be created.

    设置列表项数量。 如果列表不是虚拟的,将创建指定数量的项。 如果列表是虚拟的,则只会创建视图中的项。

  • set numItems(value): void
  • 参数

    • value: number

    返回 void

  • get padding(): number[]
  • 返回 number[]

    设定容器内部四个方向的留空。四个元素依次为[上,右,下,左]。

    Set the padding for the four directions inside the container. The four elements are in the order of [UP, RIGHT, DOWN, LEFT].

  • set padding(value): void
  • 参数

    • value: number[]

    返回 void

  • get rows(): number
  • 返回 number

    This option is only effective for FlowY layout type. If set to a value greater than 0, a new column will only be started when the number of items in each column reaches the specified value.

    这个选项只对FlowY布局类型布局有效。如果设置了大于0的值,则每列的数量到达设定的值才会开启新的一列。

  • set rows(value): void
  • 参数

    • value: number

    返回 void

方法

  • 参数

    • index: number

    返回 number

    Maps the index of the display object in the virtual list to the index of the data item.

    虚拟列表中将显示对象的索引映射到数据项的索引。

  • 参数

    • xValue: number

      The horizontal coordinate of the snapping position.

    • yValue: number

      The vertical coordinate of the snapping position.

    • xDir: number

      The horizontal direction of the snapping position, positive for right and negative for left.

    • yDir: number

      The vertical direction of the snapping position, positive for down and negative for up.

    • 可选resultPoint: Point

      The point object to store the result, if not provided, a new Point object will be created.

    返回 Point

    The snapping position as a Point object.

    Get the snapping position of the layout.

    获取对齐位置。

  • 参数

    • index: number

    返回 number

    Maps the index of the data item to the index of the display object.

    数据项的索引映射到显示对象的索引。

  • 返回 void

    Refresh the virtual list. Generally, there is no need to call this manually.

    刷新虚拟列表。一般不需要手动调用。

  • 参数

    • 可选childCount: number

      The number of children to fit in the container.

    • 可选minSize: number

      The minimum size for the container.

    返回 void

    Resize the container to fit specified child count and minimum size.

    调整容器大小以适应指定的子节点数量和最小尺寸。