Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

GuidanceStylist

open class GuidanceStylist : FragmentAnimationProvider
kotlin.Any
   ↳ androidx.leanback.widget.GuidanceStylist

GuidanceStylist is used within a 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 for more information.

If these hooks are insufficient, this class may also be subclassed. Subclasses may wish to override the onProvideLayoutId method to change the layout file used to display the guidance; more complex layouts may be supported by also providing a subclass of GuidanceStylist.Guidance with extra fields.

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

  • androidx.leanback.R.id#guidance_title
  • androidx.leanback.R.id#guidance_description
  • androidx.leanback.R.id#guidance_breadcrumb
  • androidx.leanback.R.id#guidance_icon

View IDs are allowed to be missing, in which case the corresponding views will be null. androidx.leanback.R.attr#guidedStepImeAppearingAnimation androidx.leanback.R.attr#guidedStepImeDisappearingAnimation androidx.leanback.R.attr#guidanceContainerStyle androidx.leanback.R.attr#guidanceTitleStyle androidx.leanback.R.attr#guidanceDescriptionStyle androidx.leanback.R.attr#guidanceBreadcrumbStyle androidx.leanback.R.attr#guidanceIconStyle

Summary

Nested classes

open

A data class representing contextual information for a .

Public constructors

GuidanceStylist is used within a androidx.leanback.app.GuidedStepFragment to display contextual information for the decision(s) required at that step.

Public methods

open TextView!

Returns the view displaying the breadcrumb of the guidance.

open TextView!

Returns the view displaying the description of the guidance.

open ImageView!

Returns the view displaying the icon of the guidance.

open TextView!

Returns the view displaying the title of the guidance.

open View!
onCreateView(inflater: LayoutInflater!, container: ViewGroup!, guidance: GuidanceStylist.Guidance!)

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

open Unit

Called when destroy the View created by GuidanceStylist.

open Unit
onImeAppearing(@NonNull animators: MutableList<Animator!>)

Animates the fragment in response to the IME appearing.

open Unit
onImeDisappearing(@NonNull animators: MutableList<Animator!>)

Animates the fragment in response to the IME disappearing.

open Int

Provides the resource ID of the layout defining the guidance view.

Public constructors

<init>

GuidanceStylist()

GuidanceStylist is used within a 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 for more information.

If these hooks are insufficient, this class may also be subclassed. Subclasses may wish to override the onProvideLayoutId method to change the layout file used to display the guidance; more complex layouts may be supported by also providing a subclass of GuidanceStylist.Guidance with extra fields.

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

  • androidx.leanback.R.id#guidance_title
  • androidx.leanback.R.id#guidance_description
  • androidx.leanback.R.id#guidance_breadcrumb
  • androidx.leanback.R.id#guidance_icon

View IDs are allowed to be missing, in which case the corresponding views will be null. androidx.leanback.R.attr#guidedStepImeAppearingAnimation androidx.leanback.R.attr#guidedStepImeDisappearingAnimation androidx.leanback.R.attr#guidanceContainerStyle androidx.leanback.R.attr#guidanceTitleStyle androidx.leanback.R.attr#guidanceDescriptionStyle androidx.leanback.R.attr#guidanceBreadcrumbStyle androidx.leanback.R.attr#guidanceIconStyle

Public methods

getBreadcrumbView

open fun getBreadcrumbView(): TextView!

Returns the view displaying the breadcrumb of the guidance.

Return
TextView!: The text view object for the breadcrumb.

getDescriptionView

open fun getDescriptionView(): TextView!

Returns the view displaying the description of the guidance.

Return
TextView!: The text view object for the description.

getIconView

open fun getIconView(): ImageView!

Returns the view displaying the icon of the guidance.

Return
ImageView!: The image view object for the icon.

getTitleView

open fun getTitleView(): TextView!

Returns the view displaying the title of the guidance.

Return
TextView!: The text view object for the title.

onCreateView

open fun onCreateView(inflater: LayoutInflater!, container: ViewGroup!, guidance: GuidanceStylist.Guidance!): View!

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
inflater LayoutInflater!: The layout inflater to be used when constructing the view.
container LayoutInflater!: The view group to be passed in the call to LayoutInflater.inflate.
guidance LayoutInflater!: The guidance data for the view.
Return
View!: The view to be added to the caller's view hierarchy.

onDestroyView

open fun onDestroyView(): Unit

Called when destroy the View created by GuidanceStylist.

onImeAppearing

open fun onImeAppearing(@NonNull animators: MutableList<Animator!>): Unit

Animates the fragment in response to the IME appearing.

Parameters
animators MutableList<Animator!>: A list of animations to which this provider's animations should be added.

onImeDisappearing

open fun onImeDisappearing(@NonNull animators: MutableList<Animator!>): Unit

Animates the fragment in response to the IME disappearing.

Parameters
animators MutableList<Animator!>: A list of animations to which this provider's animations should be added.

onProvideLayoutId

open fun onProvideLayoutId(): Int

Provides the resource ID of the layout defining the guidance view. Subclasses may override to provide their own customized layouts. The base implementation returns androidx.leanback.R.layout#lb_guidance. 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.

Return
Int: The resource ID of the layout to be inflated to define the guidance view.