public class CarGridTemplate
- Object
- CarTemplate
- CarGridTemplate
A grid of image-forward
CarGridItems – 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()).Constructors
public CarGridTemplate() |
Methods
public CarGridTemplate setTitle(String title) | Sets the header title. |
public CarGridTemplate addItem(CarGridItem item) | Adds an item to the grid. |
public List<CarGridItem> getItems() | Returns the grid items, in order. |
public CarActionStrip getHeaderActions() | Returns the header action strip, or null. |
public CarGridTemplate setHeaderActions(CarActionStrip headerActions) | Sets the header action strip. |
public boolean isLoading() | Returns true when the grid should render a loading spinner instead of content. |
public CarGridTemplate setLoading(boolean loading) | Marks the template as loading; the head unit renders a spinner. |
Inherited methods
From CarTemplate
Constructor details
CarGridTemplate
public CarGridTemplate()Method details
setTitle
public CarGridTemplate setTitle(String title)Sets the header title.
Parameters
titleString- the header title
Returns
this template, for chaining
addItem
public CarGridTemplate addItem(CarGridItem item)Adds an item to the grid.
Parameters
itemCarGridItem- 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
headerActionsCarActionStrip- 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
loadingboolean- true to show a spinner
Returns
this template, for chaining