PaneTemplate.Builder
public
static
final
class
PaneTemplate.Builder
extends Object
java.lang.Object | |
↳ | androidx.car.app.model.PaneTemplate.Builder |
A builder of PaneTemplate
.
Summary
Public constructors | |
---|---|
Builder(Pane pane)
Returns a new instance of a @link Builder}. |
Public methods | |
---|---|
PaneTemplate
|
build()
Constructs the template defined by this builder. |
PaneTemplate.Builder
|
setActionStrip(ActionStrip actionStrip)
Sets the |
PaneTemplate.Builder
|
setHeaderAction(Action headerAction)
Sets the |
PaneTemplate.Builder
|
setTitle(CharSequence title)
Sets the title of the template. |
Inherited methods | |
---|---|
Public constructors
Builder
public Builder (Pane pane)
Returns a new instance of a @link Builder}.
Parameters | |
---|---|
pane |
Pane |
Throws | |
---|---|
NullPointerException |
if pane is null
|
Public methods
build
public PaneTemplate build ()
Constructs the template defined by this builder.
Requirements
This template allows up to 2Row
s and 2 Action
s in the Pane
.
The host
will ignore any rows over that limit. Each Row
s can add up to 2 lines of texts
via
Row.Builder.addText(CarText)
and cannot contain either a Toggle
or a OnClickListener
.
Either a header Action
or title must be set on the template.
Returns | |
---|---|
PaneTemplate |
Throws | |
---|---|
IllegalArgumentException |
if the Pane does not meet the requirements |
IllegalStateException |
if the template does not have either a title or header
Action set
|
setActionStrip
public PaneTemplate.Builder setActionStrip (ActionStrip actionStrip)
Sets the ActionStrip
for this template.
Unless set with this method, the template will not have an action strip.
Requirements
This template allows up to 2Action
s in its ActionStrip
. Of the 2 allowed
Action
s, one of them can contain a title as set via
Action.Builder.setTitle(CarText)
. Otherwise, only Action
s with icons are allowed.
Parameters | |
---|---|
actionStrip |
ActionStrip |
Returns | |
---|---|
PaneTemplate.Builder |
Throws | |
---|---|
IllegalArgumentException |
if actionStrip does not meet the requirements |
NullPointerException |
if actionStrip is null
|
setHeaderAction
public PaneTemplate.Builder setHeaderAction (Action headerAction)
Sets the Action
that will be displayed in the header of the template.
Unless set with this method, the template will not have a header action.
Requirements
This template only supports either one ofAction.APP_ICON
and
Action.BACK
as a header Action
.
Parameters | |
---|---|
headerAction |
Action |
Returns | |
---|---|
PaneTemplate.Builder |
Throws | |
---|---|
IllegalArgumentException |
if headerAction does not meet the template's
requirements |
NullPointerException |
if headerAction is null
|
setTitle
public PaneTemplate.Builder setTitle (CharSequence title)
Sets the title of the template.
Unless set with this method, the template will not have a title.
Spans are not supported in the input string.
Parameters | |
---|---|
title |
CharSequence |
Returns | |
---|---|
PaneTemplate.Builder |
Throws | |
---|---|
NullPointerException |
if title is null |
See also: