public final class

CarMenuItem.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.car.widget.CarMenuItem.Builder

Overview

Builder for creating a CarMenuItem

Summary

Constructors
publicBuilder()

Methods
public CarMenuItembuild()

Returns a CarMenuItem built with the provided information.

public CarMenuItem.BuildersetCheckable(boolean checkable)

Sets whether the CarMenuItem is checkable or not.

public CarMenuItem.BuildersetChecked(boolean checked)

Sets whether the CarMenuItem is checked or not.

public CarMenuItem.BuildersetDisplayBehavior(CarMenuItem.DisplayBehavior displayBehavior)

Sets the display behavior of the @code CarMenuItem}.

public CarMenuItem.BuildersetEnabled(boolean enabled)

Sets whether the CarMenuItem is enabled or disabled.

public CarMenuItem.BuildersetIcon(Icon icon)

Sets the icon of the CarMenuItem.

public CarMenuItem.BuildersetOnClickListener(CarMenuItem.OnClickListener listener)

Sets CarMenuItem.OnClickListener of the CarMenuItem.

public CarMenuItem.BuildersetStyle(int styleResId)

Sets the style of the CarMenuItem.

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

Sets the title of the CarMenuItem.

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

Constructors

public Builder()

Methods

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

Sets the title of the CarMenuItem.

Parameters:

title: Title of the CarMenuItem.

Returns:

This Builder object to allow call chaining.

public CarMenuItem.Builder setOnClickListener(CarMenuItem.OnClickListener listener)

Sets CarMenuItem.OnClickListener of the CarMenuItem.

Parameters:

listener: OnClick listener of the CarMenuItem.

Returns:

This Builder object to allow call chaining.

public CarMenuItem.Builder setStyle(int styleResId)

Sets the style of the CarMenuItem.

Parameters:

styleResId: Res Id of the style to be used for the CarMenuItem.

Returns:

This Builder object to allow call chaining.

public CarMenuItem.Builder setIcon(Icon icon)

Sets the icon of the CarMenuItem.

Parameters:

icon: Icon of the CarMenuItem.

Returns:

This Builder object to allow call chaining.

public CarMenuItem.Builder setEnabled(boolean enabled)

Sets whether the CarMenuItem is enabled or disabled.

Items are enabled by default.

Parameters:

enabled: true if the CarMenuItem is enabled.

Returns:

This Builder object to allow call chaining.

public CarMenuItem.Builder setCheckable(boolean checkable)

Sets whether the CarMenuItem is checkable or not.

Checkable items are rendered as switch widgets.

Parameters:

checkable: true if the CarMenuItem is checkable.

Returns:

This Builder object to allow call chaining.

public CarMenuItem.Builder setChecked(boolean checked)

Sets whether the CarMenuItem is checked or not.

Items are unchecked by default, this has no effect if CarMenuItem.Builder.setCheckable(boolean) is false.

Parameters:

checked: true if the CarMenuItem is checked.

Returns:

This Builder object to allow call chaining.

public CarMenuItem.Builder setDisplayBehavior(CarMenuItem.DisplayBehavior displayBehavior)

Sets the display behavior of the @code CarMenuItem}. The display behavior determines whether the item is displayed on the Toolbar or in the overflow menu, see CarMenuItem.DisplayBehavior.

Parameters:

displayBehavior: Display behavior of the CarMenuItem.

Returns:

This Builder object to allow call chaining.

public CarMenuItem build()

Returns a CarMenuItem built with the provided information.