# GridSection

Artifact: [androidx.car.app:app](https://developer.android.com/jetpack/androidx/releases/car-app) [View Source](https://cs.android.com/search?q=file:androidx/car/app/model/GridSection.java+class:androidx.car.app.model.GridSection) Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.7.0)

*** ** * ** ***


```
@CarProtocol
@RequiresCarApi(value = 8)
public final class GridSection extends Section<GridItem>
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.car.app.model.Section](https://developer.android.com/reference/androidx/car/app/model/Section)\<[GridItem](https://developer.android.com/reference/androidx/car/app/model/GridItem)\> ||
|   | ↳ | [androidx.car.app.model.GridSection](https://developer.android.com/reference/androidx/car/app/model/GridSection) |

*** ** * ** ***

A section within the `SectionedItemTemplate` that contains `https://developer.android.com/reference/androidx/car/app/model/GridItem`s - good for showcase large artwork or images for every entry.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/car/app/model/GridSection.Builder extends https://developer.android.com/reference/androidx/car/app/model/Section.BaseBuilder<https://developer.android.com/reference/androidx/car/app/model/GridItem, https://developer.android.com/reference/androidx/car/app/model/GridSection.Builder>` A builder that constructs `https://developer.android.com/reference/androidx/car/app/model/GridSection` instances. |

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/car/app/model/GridSection#INCOMPLETE_LAST_ROW_AS_IS() = 0` The last row will be shown as-is. |
| `static final int` | `https://developer.android.com/reference/androidx/car/app/model/GridSection#INCOMPLETE_LAST_ROW_TRUNCATE() = 1` Truncates the last row if that row is not completely filled |
| `static final int` | `https://developer.android.com/reference/androidx/car/app/model/GridSection#ITEM_IMAGE_SHAPE_CIRCLE() = 2` Renders the image within the grid item in the shape of a circle by cropping it. |
| `static final int` | `https://developer.android.com/reference/androidx/car/app/model/GridSection#ITEM_IMAGE_SHAPE_UNSET() = 1` Renders the image within the grid item as-is without modifying its shape - this is the default. |
| `static final int` | `https://developer.android.com/reference/androidx/car/app/model/GridSection#ITEM_SIZE_EXTRA_LARGE() = 4` Renders the items within the section in an extra large sized format. |
| `static final int` | `https://developer.android.com/reference/androidx/car/app/model/GridSection#ITEM_SIZE_LARGE() = 3` Renders the items within the section in a large format. |
| `static final int` | `https://developer.android.com/reference/androidx/car/app/model/GridSection#ITEM_SIZE_MEDIUM() = 2` Renders the items within the section in a medium sized format. |
| `static final int` | `https://developer.android.com/reference/androidx/car/app/model/GridSection#ITEM_SIZE_SMALL() = 1` Renders the items within the section in a small format - this is the default. |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/car/app/model/GridSection#equals(java.lang.Object)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html other)` |
| `int` | `@https://developer.android.com/reference/androidx/car/app/annotations/RequiresCarApi(value = 9) @https://developer.android.com/reference/androidx/car/app/annotations/ExperimentalCarApi https://developer.android.com/reference/androidx/car/app/model/GridSection#getIncompleteLastRowStrategy()()` Returns the strategy for handling incomplete last row |
| `int` | `https://developer.android.com/reference/androidx/car/app/model/GridSection#getItemImageShape()()` Returns the shape which this section's grid item images should be rendered to. |
| `int` | `https://developer.android.com/reference/androidx/car/app/model/GridSection#getItemSize()()` Returns the size which this section's grid items should be rendered at. |
| `int` | `https://developer.android.com/reference/androidx/car/app/model/GridSection#hashCode()()` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/car/app/model/GridSection#toString()()` |

### Inherited methods

From [androidx.car.app.model.Section](https://developer.android.com/reference/androidx/car/app/model/Section) `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/car/app/model/CarText` `https://developer.android.com/reference/androidx/car/app/model/Section#getNoItemsMessage()()`

Returns the optional message that should appear if there are no items added to this section.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/car/app/model/OnItemVisibilityChangedDelegate` `https://developer.android.com/reference/androidx/car/app/model/Section#getOnItemVisibilityChangedDelegate()()`

Returns the `https://developer.android.com/reference/androidx/car/app/model/OnItemVisibilityChangedDelegate` to be called when the visible items in this `https://developer.android.com/reference/androidx/car/app/model/Section` changes, or `null` if one isn't set.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/car/app/model/SectionHeader` `@https://developer.android.com/reference/androidx/car/app/annotations/RequiresCarApi(value = 9)
@https://developer.android.com/reference/androidx/car/app/annotations/ExperimentalCarApi
https://developer.android.com/reference/androidx/car/app/model/Section#getSectionHeader()()`

Returns the `https://developer.android.com/reference/androidx/car/app/model/SectionHeader` for this section, or `null` if not set.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/car/app/model/CarText` `https://developer.android.com/reference/androidx/car/app/model/Section#getTitle()()`

Returns the optional text that should appear with the items in this section.

## Constants

### INCOMPLETE_LAST_ROW_AS_IS

Added in [1.9.0-alpha03](https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha03)

```
public static final int INCOMPLETE_LAST_ROW_AS_IS = 0
```

The last row will be shown as-is. This is a default behavior

### INCOMPLETE_LAST_ROW_TRUNCATE

Added in [1.9.0-alpha03](https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha03)

```
public static final int INCOMPLETE_LAST_ROW_TRUNCATE = 1
```

Truncates the last row if that row is not completely filled

### ITEM_IMAGE_SHAPE_CIRCLE

Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.7.0)

```
public static final int ITEM_IMAGE_SHAPE_CIRCLE = 2
```

Renders the image within the grid item in the shape of a circle by cropping it.

### ITEM_IMAGE_SHAPE_UNSET

Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.7.0)

```
public static final int ITEM_IMAGE_SHAPE_UNSET = 1
```

Renders the image within the grid item as-is without modifying its shape - this is the default.

### ITEM_SIZE_EXTRA_LARGE

Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.8.0)

```
public static final int ITEM_SIZE_EXTRA_LARGE = 4
```

Renders the items within the section in an extra large sized format.

### ITEM_SIZE_LARGE

Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.7.0)

```
public static final int ITEM_SIZE_LARGE = 3
```

Renders the items within the section in a large format.

### ITEM_SIZE_MEDIUM

Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.7.0)

```
public static final int ITEM_SIZE_MEDIUM = 2
```

Renders the items within the section in a medium sized format.

### ITEM_SIZE_SMALL

Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.7.0)

```
public static final int ITEM_SIZE_SMALL = 1
```

Renders the items within the section in a small format - this is the default.

## Public methods

### equals

```
public boolean equals(@Nullable Object other)
```

### getIncompleteLastRowStrategy

Added in [1.9.0-alpha03](https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha03)

```
@RequiresCarApi(value = 9)
@ExperimentalCarApi
public int getIncompleteLastRowStrategy()
```

Returns the strategy for handling incomplete last row

### getItemImageShape

Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.7.0)

```
public int getItemImageShape()
```

Returns the shape which this section's grid item images should be rendered to.

### getItemSize

Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.7.0)

```
public int getItemSize()
```

Returns the size which this section's grid items should be rendered at.

### hashCode

```
public int hashCode()
```

### toString

```
public @NonNull String toString()
```