interface ILayout {
    align: AlignType;
    columnGap: number;
    columns: number;
    contentHeight: number;
    contentWidth: number;
    foldInvisibles: boolean;
    minChildSize: 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;
    getSnappingPosition(xValue: number, yValue: number, xDir: number, yDir: number, resultPoint?: Point): Point;
    refresh(force?: boolean): 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 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

方法

  • 参数

    • 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.

    获取对齐位置。

  • 参数

    • 可选force: boolean

      Whether to force a refresh even if no changes have occurred.

    返回 void

    Refresh the layout if necessary.

    如果需要,刷新布局。

  • 参数

    • 可选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.

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

  • 参数

    返回 void

    Notify the layout that any changes have occurred that require a layout update.

    通知布局发生了任何需要更新布局的更改。