Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

ActionBar

open class ActionBar : RelativeLayout
kotlin.Any
   ↳ android.view.View
   ↳ android.view.ViewGroup
   ↳ android.widget.RelativeLayout
   ↳ androidx.car.widget.ActionBar

An actions panel with three distinctive zones:

  • Main control: located in the bottom center it shows a highlighted icon and a circular progress bar.
  • Secondary controls: these are displayed at the left and at the right of the main control.
  • Overflow controls: these are displayed at the left and at the right of the secondary controls (if the space allows) and on the additional space if the panel is expanded.

Summary

Nested classes

Constants
static Int

Slot used for main actions ActionBar, usually at the bottom center

static Int

Slot used to host 'move left', 'rewind', 'previous' or similar secondary actions, usually at the left of the main action on the bottom row

static Int

Slot used to host 'move right', 'fast-forward', 'next' or similar secondary actions, usually at the right of the main action on the bottom row

static Int

Slot reserved for the expand/collapse button

Public constructors
<init>(context: Context!)

<init>(context: Context!, attrs: AttributeSet!)

<init>(context: Context!, attrs: AttributeSet!, defStyleAttrs: Int)

<init>(context: Context!, attrs: AttributeSet!, defStyleAttrs: Int, defStyleRes: Int)

Public methods
open Unit
setView(@Nullable view: View?, slotPosition: Int)

Sets or clears the view to be displayed at a particular position.

open Unit
setExpandCollapseView(@NonNull view: View)

Sets the view to use for the expand/collapse action.

open Unit
setViews(@Nullable views: Array<View!>?)

Sets the views to include in each available slot of the action bar.

Constants

SLOT_MAIN

static val SLOT_MAIN: Int

Slot used for main actions ActionBar, usually at the bottom center

Value: 0

SLOT_LEFT

static val SLOT_LEFT: Int

Slot used to host 'move left', 'rewind', 'previous' or similar secondary actions, usually at the left of the main action on the bottom row

Value: 1

SLOT_RIGHT

static val SLOT_RIGHT: Int

Slot used to host 'move right', 'fast-forward', 'next' or similar secondary actions, usually at the right of the main action on the bottom row

Value: 2

SLOT_EXPAND_COLLAPSE

static val SLOT_EXPAND_COLLAPSE: Int

Slot reserved for the expand/collapse button

Value: 3

Public constructors

<init>

ActionBar(context: Context!)

<init>

ActionBar(context: Context!, attrs: AttributeSet!)

<init>

ActionBar(context: Context!, attrs: AttributeSet!, defStyleAttrs: Int)

<init>

ActionBar(context: Context!, attrs: AttributeSet!, defStyleAttrs: Int, defStyleRes: Int)

Public methods

setView

open fun setView(@Nullable view: View?, slotPosition: Int): Unit

Sets or clears the view to be displayed at a particular position.

Parameters
view View?: view to be displayed, or null to leave the position available.
slotPosition View?: position to update

setExpandCollapseView

open fun setExpandCollapseView(@NonNull view: View): Unit

Sets the view to use for the expand/collapse action. If not provided, a default ImageButton will be used. The provided View should be able be able to display changes in the "activated" state appropriately.

Parameters
view View: View to use for the expand/collapse action.

setViews

open fun setViews(@Nullable views: Array<View!>?): Unit

Sets the views to include in each available slot of the action bar. Slots will be filled from start to end (i.e: left to right) and from bottom to top. If more views than available slots are provided, all extra views will be ignored.

Parameters
views Array<View!>?: array of views to include in each available slot.