# SectionedItemTemplate

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/SectionedItemTemplate.java+class:androidx.car.app.model.SectionedItemTemplate) Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.7.0)

*** ** * ** ***


```
@RequiresCarApi(value = 8)
@CarProtocol
class SectionedItemTemplate : Template
```

<br />

*** ** * ** ***

A template that contains sections of items like rows, grid items, chips, etc.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate.Builder` A builder that constructs `https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate` instances. |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate#ALPHABETICAL_INDEXING_DISABLED() = 0` Indicate that alphabetical indexing should not be available for the template which also disables any UI accelerators that the user may be shown to help the user navigate larger lists. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate#ALPHABETICAL_INDEXING_TITLE_AS_IS() = 1` Indicates that alphabetical indexing should use the item's title as-is with no processing. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate#ALPHABETICAL_INDEXING_TITLE_IGNORE_ARTICLES_AND_SYMBOLS() = 2` Indicates that alphabetical indexing should ignore English articles (like "the", "an", and "a") as well as non-alphanumeric symbols. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate#SCROLL_STATE_PRESERVE_INDEX() = 1` Indicate that the scroll position should be preserved by scrolling back down to the same index that the user had scrolled to. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate#SCROLL_STATE_RESET_TO_TOP() = 0` Indicate that the scroll position should reset back to the top when this template is refreshed. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate#equals(java.lang.Object)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/car/app/model/Action!>` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate#getActions()()` Returns the list of actions that should appear alongside the content of this template. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate#getAlphabeticalIndexingStrategy()()` Returns the alphabetical indexing strategy. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/Header?` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate#getHeader()()` Returns the optional header for this template. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate#getScrollStatePersistenceStrategy()()` Returns the strategy to use when this template is used as a refresh. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchHeader?` | `@https://developer.android.com/reference/kotlin/androidx/car/app/annotations/ExperimentalCarApi @https://developer.android.com/reference/kotlin/androidx/car/app/annotations/RequiresCarApi(value = 9) https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate#getSearchHeader()()` Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchHeader` for this template or `null` if not set. |
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/car/app/model/Section<*>!>` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate#getSections()()` Returns the list of sections within this template. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate#hashCode()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `[isAlphabeticalIndexingAllowed](https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate#isAlphabeticalIndexingAllowed())()` **This function is deprecated.** use `https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate#getAlphabeticalIndexingStrategy()` with `https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate.Builder#setAlphabeticalIndexingStrategy(int)` <br /> |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate#isLoading()()` Returns whether or not this template is in a loading state. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate#toString()()` |

## Constants

### ALPHABETICAL_INDEXING_DISABLED

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

```
const val ALPHABETICAL_INDEXING_DISABLED = 0: Int
```

Indicate that alphabetical indexing should not be available for the template which also disables any UI accelerators that the user may be shown to help the user navigate larger lists.

This is the default behavior if not explicitly set.

### ALPHABETICAL_INDEXING_TITLE_AS_IS

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

```
const val ALPHABETICAL_INDEXING_TITLE_AS_IS = 1: Int
```

Indicates that alphabetical indexing should use the item's title as-is with no processing.

Note that a UI accelerator may still group the item under the "miscellaneous" category if the title starts with a non-alphabetical character.

### ALPHABETICAL_INDEXING_TITLE_IGNORE_ARTICLES_AND_SYMBOLS

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

```
const val ALPHABETICAL_INDEXING_TITLE_IGNORE_ARTICLES_AND_SYMBOLS = 2: Int
```

Indicates that alphabetical indexing should ignore English articles (like "the", "an", and "a") as well as non-alphanumeric symbols.

Note this will not change the display of the item's title, just how it's sorted. For example, "The Example Song" will continue to show up as "The Example Song", but will be sorted into the "E" bucket.

### SCROLL_STATE_PRESERVE_INDEX

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

```
const val SCROLL_STATE_PRESERVE_INDEX = 1: Int
```

Indicate that the scroll position should be preserved by scrolling back down to the same index that the user had scrolled to.

If the index no longer exists, the scroll position will be set to the bottom of the new list.

### SCROLL_STATE_RESET_TO_TOP

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

```
const val SCROLL_STATE_RESET_TO_TOP = 0: Int
```

Indicate that the scroll position should reset back to the top when this template is refreshed.

This is the default behavior if not explicitly set.

## Public functions

### equals

```
fun equals(other: Any?): Boolean
```

### getActions

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

```
fun getActions(): (Mutable)List<Action!>
```

Returns the list of actions that should appear alongside the content of this template.

### getAlphabeticalIndexingStrategy

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

```
fun getAlphabeticalIndexingStrategy(): Int
```

Returns the alphabetical indexing strategy.

"Indexing" refers to the process of examining list contents (e.g. item titles) to sort, partition, or filter a list. Indexing is generally used for features called "Accelerators", which allow a user to quickly find a particular `https://developer.android.com/reference/kotlin/androidx/car/app/model/Item` in a long list.

Individual items may be excluded from the list by setting their `#isIndexable` field to `false`.

### getHeader

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

```
fun getHeader(): Header?
```

Returns the optional header for this template.

### getScrollStatePersistenceStrategy

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

```
fun getScrollStatePersistenceStrategy(): Int
```

Returns the strategy to use when this template is used as a refresh. See `https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate.Builder#setScrollStatePersistenceStrategy(int)`

### getSearchHeader

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

```
@ExperimentalCarApi
@RequiresCarApi(value = 9)
fun getSearchHeader(): SearchHeader?
```

Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchHeader` for this template or `null` if not set.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate.Builder#setSearchHeader(androidx.car.app.model.SearchHeader)` |   |

### getSections

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

```
fun getSections(): (Mutable)List<Section<*>!>
```

Returns the list of sections within this template.

### hashCode

```
fun hashCode(): Int
```

### isAlphabeticalIndexingAllowed

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

```
fun [isAlphabeticalIndexingAllowed](https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate#isAlphabeticalIndexingAllowed())(): Boolean
```

> [!CAUTION]
> **This function is deprecated.**   
>
> use `https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate#getAlphabeticalIndexingStrategy()` with `https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate.Builder#setAlphabeticalIndexingStrategy(int)`

Returns whether this list can be indexed alphabetically, by item title.

"Indexing" refers to the process of examining list contents (e.g. item titles) to sort, partition, or filter a list. Indexing is generally used for features called "Accelerators", which allow a user to quickly find a particular `https://developer.android.com/reference/kotlin/androidx/car/app/model/Item` in a long list.

To exclude a single item from indexing, see the relevant item's API.

To enable/disable accelerators for the entire list, see `https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemTemplate.Builder#setAlphabeticalIndexingAllowed(boolean)`

### isLoading

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

```
fun isLoading(): Boolean
```

Returns whether or not this template is in a loading state.

### toString

```
fun toString(): String
```