Register now for Android Dev Summit 2019!

Builder

class Builder
kotlin.Any
   ↳ androidx.car.widget.CarMenuItem.Builder

Builder for creating a CarMenuItem

Summary

Public constructors

Builder for creating a CarMenuItem

Public methods

CarMenuItem

Returns a CarMenuItem built with the provided information.

CarMenuItem.Builder
setCheckable(checkable: Boolean)

Sets whether the CarMenuItem is checkable or not.

CarMenuItem.Builder
setChecked(checked: Boolean)

Sets whether the CarMenuItem is checked or not.

CarMenuItem.Builder

Sets the display behavior of the @code CarMenuItem}.

CarMenuItem.Builder
setEnabled(enabled: Boolean)

Sets whether the CarMenuItem is enabled or disabled.

CarMenuItem.Builder
setIcon(@NonNull icon: Icon)

Sets the icon of the CarMenuItem.

CarMenuItem.Builder

Sets OnClickListener of the CarMenuItem.

CarMenuItem.Builder
setStyle(@StyleRes styleResId: Int)

Sets the style of the CarMenuItem.

CarMenuItem.Builder
setTitle(@NonNull title: CharSequence)

Sets the title of the CarMenuItem.

Public constructors

<init>

Builder()

Builder for creating a CarMenuItem

Public methods

build

@NonNull fun build(): CarMenuItem

Returns a CarMenuItem built with the provided information.

setCheckable

@NonNull fun setCheckable(checkable: Boolean): CarMenuItem.Builder

Sets whether the CarMenuItem is checkable or not.

Checkable items are rendered as switch widgets.

Parameters
checkable Boolean: true if the CarMenuItem is checkable.
Return
CarMenuItem.Builder: This Builder object to allow call chaining.

setChecked

@NonNull fun setChecked(checked: Boolean): CarMenuItem.Builder

Sets whether the CarMenuItem is checked or not.

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

Parameters
checked Boolean: true if the CarMenuItem is checked.
Return
CarMenuItem.Builder: This Builder object to allow call chaining.

setDisplayBehavior

@NonNull fun setDisplayBehavior(@NonNull displayBehavior: CarMenuItem.DisplayBehavior): CarMenuItem.Builder

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 DisplayBehavior.

Parameters
displayBehavior CarMenuItem.DisplayBehavior: Display behavior of the CarMenuItem.
Return
CarMenuItem.Builder: This Builder object to allow call chaining.

setEnabled

@NonNull fun setEnabled(enabled: Boolean): CarMenuItem.Builder

Sets whether the CarMenuItem is enabled or disabled.

Items are enabled by default.

Parameters
enabled Boolean: true if the CarMenuItem is enabled.
Return
CarMenuItem.Builder: This Builder object to allow call chaining.

setIcon

@NonNull fun setIcon(@NonNull icon: Icon): CarMenuItem.Builder

Sets the icon of the CarMenuItem.

Parameters
icon Icon: Icon of the CarMenuItem.
Return
CarMenuItem.Builder: This Builder object to allow call chaining.

setOnClickListener

@NonNull fun setOnClickListener(@NonNull listener: CarMenuItem.OnClickListener): CarMenuItem.Builder

Sets OnClickListener of the CarMenuItem.

Parameters
listener CarMenuItem.OnClickListener: OnClick listener of the CarMenuItem.
Return
CarMenuItem.Builder: This Builder object to allow call chaining.

setStyle

@NonNull fun setStyle(@StyleRes styleResId: Int): CarMenuItem.Builder

Sets the style of the CarMenuItem.

Parameters
styleResId Int: Res Id of the style to be used for the CarMenuItem.
Return
CarMenuItem.Builder: This Builder object to allow call chaining.

setTitle

@NonNull fun setTitle(@NonNull title: CharSequence): CarMenuItem.Builder

Sets the title of the CarMenuItem.

Parameters
title CharSequence: Title of the CarMenuItem.
Return
CarMenuItem.Builder: This Builder object to allow call chaining.