# GuidanceStylist

Artifact: [androidx.leanback:leanback](https://developer.android.com/jetpack/androidx/releases/leanback) [View Source](https://cs.android.com/search?q=file:androidx/leanback/widget/GuidanceStylist.java+class:androidx.leanback.widget.GuidanceStylist) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

*** ** * ** ***


```
public class GuidanceStylist implements FragmentAnimationProvider
```

<br />

*** ** * ** ***

GuidanceStylist is used within a `https://developer.android.com/reference/androidx/leanback/app/GuidedStepFragment` to display contextual information for the decision(s) required at that step.

Many aspects of the base GuidanceStylist can be customized through theming; see the theme attributes below. Note that these attributes are not set on individual elements in layout XML, but instead would be set in a custom theme. See [Styles and Themes](http://developer.android.com/guide/topics/ui/themes.html) for more information.

If these hooks are insufficient, this class may also be subclassed. Subclasses may wish to override the `https://developer.android.com/reference/androidx/leanback/widget/GuidanceStylist#onProvideLayoutId()` method to change the layout file used to display the guidance; more complex layouts may be supported by also providing a subclass of `https://developer.android.com/reference/androidx/leanback/widget/GuidanceStylist.Guidance` with extra fields.

Note: If an alternate layout is provided, the following view IDs should be used to refer to base elements:

- 
- 
- 
- 

View IDs are allowed to be missing, in which case the corresponding views will be null.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/leanback/app/GuidedStepFragment` |   |
| `https://developer.android.com/reference/androidx/leanback/widget/GuidanceStylist.Guidance` |   |

## Summary

| ### Nested types |
|---|
| `public class https://developer.android.com/reference/androidx/leanback/widget/GuidanceStylist.Guidance` A data class representing contextual information for a `https://developer.android.com/reference/androidx/leanback/app/GuidedStepFragment`. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/leanback/widget/GuidanceStylist#GuidanceStylist()()` |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/widget/TextView.html` | `https://developer.android.com/reference/androidx/leanback/widget/GuidanceStylist#getBreadcrumbView()()` Returns the view displaying the breadcrumb of the guidance. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/widget/TextView.html` | `https://developer.android.com/reference/androidx/leanback/widget/GuidanceStylist#getDescriptionView()()` Returns the view displaying the description of the guidance. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/widget/ImageView.html` | `https://developer.android.com/reference/androidx/leanback/widget/GuidanceStylist#getIconView()()` Returns the view displaying the icon of the guidance. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/widget/TextView.html` | `https://developer.android.com/reference/androidx/leanback/widget/GuidanceStylist#getTitleView()()` Returns the view displaying the title of the guidance. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html` | `https://developer.android.com/reference/androidx/leanback/widget/GuidanceStylist#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,androidx.leanback.widget.GuidanceStylist.Guidance)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/LayoutInflater.html inflater, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/view/ViewGroup.html container, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/leanback/widget/GuidanceStylist.Guidance guidance )` Creates an appropriately configured view for the given Guidance, using the provided inflater and container. |
| `void` | `https://developer.android.com/reference/androidx/leanback/widget/GuidanceStylist#onDestroyView()()` Called when destroy the View created by GuidanceStylist. |
| `void` | `https://developer.android.com/reference/androidx/leanback/widget/GuidanceStylist#onImeAppearing(java.util.List<android.animation.Animator>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/android/animation/Animator.html> animators)` Animates the fragment in response to the IME appearing. |
| `void` | `https://developer.android.com/reference/androidx/leanback/widget/GuidanceStylist#onImeDisappearing(java.util.List<android.animation.Animator>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/android/animation/Animator.html> animators)` Animates the fragment in response to the IME disappearing. |
| `int` | `https://developer.android.com/reference/androidx/leanback/widget/GuidanceStylist#onProvideLayoutId()()` Provides the resource ID of the layout defining the guidance view. |

## Public constructors

### GuidanceStylist

Added in 1.1.0

```
public GuidanceStylist()
```

## Public methods

### getBreadcrumbView

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public @Nullable TextView getBreadcrumbView()
```

Returns the view displaying the breadcrumb of the guidance.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/widget/TextView.html` | The text view object for the breadcrumb. |

### getDescriptionView

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public @Nullable TextView getDescriptionView()
```

Returns the view displaying the description of the guidance.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/widget/TextView.html` | The text view object for the description. |

### getIconView

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public @Nullable ImageView getIconView()
```

Returns the view displaying the icon of the guidance.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/widget/ImageView.html` | The image view object for the icon. |

### getTitleView

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public @Nullable TextView getTitleView()
```

Returns the view displaying the title of the guidance.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/widget/TextView.html` | The text view object for the title. |

### onCreateView

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public @NonNull View onCreateView(
    @NonNull LayoutInflater inflater,
    @Nullable ViewGroup container,
    @NonNull GuidanceStylist.Guidance guidance
)
```

Creates an appropriately configured view for the given Guidance, using the provided inflater and container.

*Note: Does not actually add the created view to the container; the caller should do this.*

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/LayoutInflater.html inflater` | The layout inflater to be used when constructing the view. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/view/ViewGroup.html container` | The view group to be passed in the call to `LayoutInflater.inflate`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/leanback/widget/GuidanceStylist.Guidance guidance` | The guidance data for the view. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html` | The view to be added to the caller's view hierarchy. |

### onDestroyView

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public void onDestroyView()
```

Called when destroy the View created by GuidanceStylist.

### onImeAppearing

```
public void onImeAppearing(@NonNull List<Animator> animators)
```

Animates the fragment in response to the IME appearing.

### onImeDisappearing

```
public void onImeDisappearing(@NonNull List<Animator> animators)
```

Animates the fragment in response to the IME disappearing.

### onProvideLayoutId

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public int onProvideLayoutId()
```

Provides the resource ID of the layout defining the guidance view. Subclasses may override to provide their own customized layouts. The base implementation returns . If overridden, the substituted layout should contain matching IDs for any views that should be managed by the base class; this can be achieved by starting with a copy of the base layout file.

| Returns |
|---|---|
| `int` | The resource ID of the layout to be inflated to define the guidance view. |