Skip to main content

GridView

declare class GridView extends ViewGroup {}

A view that shows items in two-dimensional scrolling grid.

Attribute

columnWidth

<GridView columnWidth="2" />
  • Description

    Specifies the fixed width for each column.

gravity

<GridView gravity="center" />
  • Description

    Specifies the gravity within each cell.
    bottom center center_horizontal center_vertical clip_horizontal clip_vertical end fill fill_vertical fill_horizontal left right start top.

horizontalSpacing

<GridView horizontalSpacing="20px" />
  • Description

    Defines the default horizontal spacing between columns.

numColumns

<GridView numColumns="3" />
  • Description

    Defines how many columns to show.

stretchMode

<GridView stretchMode="none" />
  • Description

    Defines how columns should stretch to fill the available empty space, if any.

`columnWidth` `none` `spacingWidth` `spacingWidthUniform`.

verticalSpacing

<GridView verticalSpacing="3" />
  • Description

    Defines the default vertical spacing between rows.

Instance Method

getAdapter

declare class GridView {
getAdapter(): ListAdapter
}
  • Description

    Returns the adapter currently associated with this widget.

setAdapter

declare class GridView {
setAdapter(adapter: ListAdapter): void
}
  • Description

    Sets the data behind this GridView.