GuidanceStylist
public class GuidanceStylist implements FragmentAnimationProvider
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:
View IDs are allowed to be missing, in which case the corresponding views will be null. guidedStepImeAppearingAnimationguidedStepImeDisappearingAnimationguidanceContainerStyleguidanceTitleStyleguidanceDescriptionStyleguidanceBreadcrumbStyleguidanceIconStyle
Summary
Nested types |
|---|
public class GuidanceStylist.GuidanceA data class representing contextual information for a |
Public constructors |
|---|
Public methods |
|
|---|---|
@Nullable TextView |
Returns the view displaying the breadcrumb of the guidance. |
@Nullable TextView |
Returns the view displaying the description of the guidance. |
@Nullable ImageView |
Returns the view displaying the icon of the guidance. |
@Nullable TextView |
Returns the view displaying the title of the guidance. |
@NonNull View |
onCreateView(Creates an appropriately configured view for the given Guidance, using the provided inflater and container. |
void |
Called when destroy the View created by GuidanceStylist. |
void |
onImeAppearing(@NonNull List<Animator> animators)Animates the fragment in response to the IME appearing. |
void |
onImeDisappearing(@NonNull List<Animator> animators)Animates the fragment in response to the IME disappearing. |
int |
Provides the resource ID of the layout defining the guidance view. |
Public constructors
Public methods
getBreadcrumbView
public @Nullable TextView getBreadcrumbView()
Returns the view displaying the breadcrumb of the guidance.
getDescriptionView
public @Nullable TextView getDescriptionView()
Returns the view displaying the description of the guidance.
getIconView
public @Nullable ImageView getIconView()
Returns the view displaying the icon of the guidance.
getTitleView
public @Nullable TextView getTitleView()
Returns the view displaying the title of the guidance.
onCreateView
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 | |
|---|---|
@NonNull LayoutInflater inflater |
The layout inflater to be used when constructing the view. |
@Nullable ViewGroup container |
The view group to be passed in the call to |
@NonNull GuidanceStylist.Guidance guidance |
The guidance data for the view. |
onDestroyView
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
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 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.
| Returns | |
|---|---|
int |
The resource ID of the layout to be inflated to define the guidance view. |