WearableActionDrawerView

public class WearableActionDrawerView extends WearableDrawerView


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 inflate. 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, clear, removeItem, findItem, size, and getItem are implemented.

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

Summary

Public constructors

WearableActionDrawerView(
    @NonNull Context context,
    @NonNull AttributeSet attrs
)
WearableActionDrawerView(
    @NonNull Context context,
    @NonNull AttributeSet attrs,
    @NonNull int defStyleAttr
)
WearableActionDrawerView(
    @NonNull Context context,
    @NonNull AttributeSet attrs,
    @NonNull int defStyleAttr,
    @NonNull int defStyleRes
)

Public methods

@Override @NonNull boolean
@NonNull Menu

Returns the Menu object that this WearableActionDrawer represents.

@Override @NonNull void

Called when the drawer has settled in a completely open state.

@Override @NonNull void

Called when anything within the peek container is clicked.

@NonNull void

Set a OnMenuItemClickListener for this action drawer.

@NonNull void

Sets the title for this action drawer.