public final class

Header.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.car.app.model.Header.Builder

Overview

A builder of Header.

Summary

Constructors
publicBuilder()

Methods
public Header.BuilderaddEndHeaderAction(Action headerAction)

Adds an Action that will be displayed at the end of a header.

public Headerbuild()

Constructs the component defined by this builder.

public Header.BuildersetStartHeaderAction(Action headerAction)

Sets the Action that will be displayed at the start of a header.

public Header.BuildersetTitle(CarText title)

Sets the title of the component, with support for multiple length variants.

public Header.BuildersetTitle(java.lang.CharSequence title)

Sets the title of the component.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder()

Methods

public Header.Builder addEndHeaderAction(Action headerAction)

Adds an Action that will be displayed at the end of a header.

Note: End header action will show up differently inside and outside of map-based templates.

  • In a Non-map screen (eg. MessageTemplate), actions appear as is, just as the app provides. A background color is allowed on the primary action.
  • In a Map-based screen (eg. Setting Header in the ContentTemplate in a MapWithContentTemplate) only actions with custom icons or standard actions will appear in the Header. The label will be stripped off each action if an app still provides that. Any tint on the icon will be disabled and default to neutral token. The background color on the primary action would also be removed.

public Header.Builder setStartHeaderAction(Action headerAction)

Sets the Action that will be displayed at the start of a header.

By default, a header will not have a start action.

Requirements

Only one of Action.APP_ICON or Action.BACK is supported as a start header Action.

public Header.Builder setTitle(java.lang.CharSequence title)

Sets the title of the component.

Only DistanceSpans and DurationSpans are supported in the input string.

See also: CarText

public Header.Builder setTitle(CarText title)

Sets the title of the component, with support for multiple length variants.

Only DistanceSpans and DurationSpans are supported in the input string.

See also: CarText

public Header build()

Constructs the component defined by this builder.

Requirements

Either a start header Action or title must be set on the component.