Google is committed to advancing racial equity for Black communities. See how.

WearableActionDrawerView

open class WearableActionDrawerView : WearableDrawerView
kotlin.Any
   ↳ android.view.View
   ↳ android.view.ViewGroup
   ↳ android.widget.FrameLayout
   ↳ androidx.wear.widget.drawer.WearableDrawerView
   ↳ androidx.wear.widget.drawer.WearableActionDrawerView

Ease of use class for creating a Wearable action drawer. This can be used with to create a drawer for users to easily pull up contextual actions. These contextual actions may be specified by using a Menu, which may be populated by either:

  • Specifying the app:actionMenu attribute in the XML layout file. Example:
    <androidx.wear.widget.drawer.WearableActionDrawerView
          xmlns:app="http://schemas.android.com/apk/res-auto"
          android:layout_width=”match_parent”
          android:layout_height=”match_parent”
          app:actionMenu="@menu/action_drawer" />
  • Getting the menu with getMenu, and then inflating it with . Example:
    Menu menu = actionDrawer.getMenu();
      getMenuInflater().inflate(R.menu.action_drawer, menu);

The full Menu and MenuItem APIs are not implemented. The following methods are guaranteed to work:

For Menu, the add methods, Menu#clear, Menu#removeItem, , Menu#size, and Menu#getItem are implemented.

For MenuItem, setting and getting the title and icon, MenuItem#getItemId, and MenuItem#setOnMenuItemClickListener are implemented.

Summary

Inherited constants
Public constructors
<init>(context: Context!)

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

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

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

Public methods
open Boolean

open Menu!

Returns the Menu object that this WearableActionDrawer represents.

open Unit

open Unit

open Unit

Set a OnMenuItemClickListener for this action drawer.

open Unit
setTitle(@Nullable title: CharSequence?)

Sets the title for this action drawer.

Inherited functions

Public constructors

<init>

WearableActionDrawerView(context: Context!)

<init>

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

<init>

WearableActionDrawerView(
    context: Context!,
    attrs: AttributeSet!,
    defStyleAttr: Int)

<init>

WearableActionDrawerView(
    context: Context!,
    attrs: AttributeSet!,
    defStyleAttr: Int,
    defStyleRes: Int)

Public methods

canScrollHorizontally

open fun canScrollHorizontally(direction: Int): Boolean

getMenu

open fun getMenu(): Menu!

Returns the Menu object that this WearableActionDrawer represents.

Applications should use this method to obtain the WearableActionDrawers's Menu object and inflate or add content to it as necessary.

Return
Menu! the Menu presented by this view

onDrawerOpened

open fun onDrawerOpened(): Unit

onPeekContainerClicked

open fun onPeekContainerClicked(v: View!): Unit

setOnMenuItemClickListener

open fun setOnMenuItemClickListener(listener: OnMenuItemClickListener!): Unit

Set a OnMenuItemClickListener for this action drawer.

setTitle

open fun setTitle(@Nullable title: CharSequence?): Unit

Sets the title for this action drawer. If title is null, then the title will be removed.