# Class CarGridTemplate

java.lang.Object
com.codename1.car.CarTemplate
com.codename1.car.CarGridTemplate

public class CarGridTemplate extends CarTemplate
A grid of image-forward `CarGridItem`s -- browse categories, station presets, playlist artwork. Maps to `androidx.car.app.model.GridTemplate` and `CPGridTemplate` (which itself caps the grid, typically at eight buttons; see `CarContext#getGridItemLimit()`).

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CarGridTemplate()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `CarGridTemplate`
  `addItem(CarGridItem item)`
  Adds an item to the grid.
  `CarActionStrip`
  `getHeaderActions()`
  Returns the header action strip, or null.
  `List<CarGridItem>`
  `getItems()`
  Returns the grid items, in order.
  `boolean`
  `isLoading()`
  Returns true when the grid should render a loading spinner instead of content.
  `CarGridTemplate`
  `setHeaderActions(CarActionStrip headerActions)`
  Sets the header action strip.
  `CarGridTemplate`
  `setLoading(boolean loading)`
  Marks the template as loading; the head unit renders a spinner.
  `CarGridTemplate`
  `setTitle(String title)`
  Sets the header title.

  ### Methods inherited from class CarTemplate

  `getTitle`

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### CarGridTemplate

    public CarGridTemplate()

- ## Method Details

  - ### setTitle

    public CarGridTemplate setTitle(String title)

    Sets the header title.

    ###### Parameters

    - `title`: the header title

    ###### Returns

    this template, for chaining

  - ### addItem

    public CarGridTemplate addItem(CarGridItem item)

    Adds an item to the grid.

    ###### Parameters

    - `item`: the grid item to add

    ###### Returns

    this template, for chaining

  - ### getItems

    public List<CarGridItem> getItems()
    Returns the grid items, in order.

  - ### getHeaderActions

    public CarActionStrip getHeaderActions()
    Returns the header action strip, or null.

  - ### setHeaderActions

    public CarGridTemplate setHeaderActions(CarActionStrip headerActions)

    Sets the header action strip.

    ###### Parameters

    - `headerActions`: the action strip

    ###### Returns

    this template, for chaining

  - ### isLoading

    public boolean isLoading()
    Returns true when the grid should render a loading spinner instead of content.

  - ### setLoading

    public CarGridTemplate setLoading(boolean loading)

    Marks the template as loading; the head unit renders a spinner.

    ###### Parameters

    - `loading`: true to show a spinner

    ###### Returns

    this template, for chaining