Skip to main content

GridLayout

declare class GridLayout extends ViewGroup {}

A layout that places its children in a rectangular grid.

Attribute

columnCount

<GridLayout columnCount="1">
....
</GridLayout>
  • Description

    The maximum number of columns to create when automatically positioning children.

columnOrderPreserved

<GridLayout columnOrderPreserved="true">
....
</GridLayout>
  • Description

    When set to true, forces column boundaries to appear in the same order as column indices.

orientation

<GridLayout orientation="horizontal">
....
</GridLayout>
  • Description

    The orientation property is not used during layout. horizontal vertical

rowCount

<GridLayout rowCount="2">
....
</GridLayout>
  • Description

    The maximum number of rows to create when automatically positioning children.

rowOrderPreserved

<GridLayout rowOrderPreserved="false">
....
</GridLayout>
  • Description

    When set to true, forces row boundaries to appear in the same order as row indices.

useDefaultMargins

<GridLayout useDefaultMargins="false">
....
</GridLayout>
  • Description

    When set to true, tells GridLayout to use default margins when none are specified in a view's layout parameters.

GridLayout.LayoutParams

Layout information associated with each of the children of a GridLayout.

declare class LayoutParams extends ViewGroup.MarginLayoutParams {}

Attribute

layout_gravity

<GridLayout>
<View layout_gravity="center"/>
</GridLayout>
  • Description

    The column boundary delimiting the left of the group of cells occupied by this view.
    center_verticalcenter_horizontal none top bottom left right center fill fill_vertical fill_horizontal axis_clipclip_vertical clip_horizontal

layout_column

<GridLayout>
<View layout_column="2"/>
</GridLayout>
  • Description

    The column boundary delimiting the left of the group of cells occupied by this view.

layout_columnSpan

<GridLayout>
<View layout_columnSpan="2"/>
</GridLayout>
  • Description

    The column span: the difference between the right and left boundaries delimiting the group of cells occupied by this view.

layout_columnWeight

<GridLayout>
<View layout_columnWeight="2"/>
</GridLayout>
  • Description

    The relative proportion of horizontal space that should be allocated to this view during excess space distribution.

layout_row

<GridLayout>
<View layout_row="2"/>
</GridLayout>
  • Description

    The row boundary delimiting the top of the group of cells occupied by this view.

layout_rowSpan

<GridLayout>
<View layout_rowSpan="2"/>
</GridLayout>
  • Description

    The row span: the difference between the top and bottom boundaries delimiting the group of cells occupied by this view.

layout_rowWeight

<GridLayout>
<View layout_rowWeight="2"/>
</GridLayout>
  • Description

    The row span: the difference between the top and bottom boundaries delimiting the group of cells occupied by this view.