Skip to content

Most visited

Recently visited

navigation

WearableActionDrawer

public class WearableActionDrawer
extends WearableDrawerView

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.FrameLayout
         ↳ android.support.wearable.view.drawer.WearableDrawerView
           ↳ android.support.wearable.view.drawer.WearableActionDrawer


This class is deprecated.
use the android.support.wear.widget.drawer.WearableActionDrawerView provided by the Android Support Library Wear module instead.

Ease of use class for creating a Wearable action drawer. This can be used with WearableDrawerLayout 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 action_menu attribute in the XML layout file. Example:
     <WearableActionDrawer
         xmlns:app="http://schemas.android.com/apk/res-auto"
         android:layout_width=”match_parent”
         android:layout_height=”match_parent”
         app:action_menu="@menu/action_drawer" />
  • Getting the menu with getMenu(), and then inflating it with inflate(int, Menu). 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(int), findItem(int), size(), and getItem(int) are implemented.

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

Summary

Nested classes

interface WearableActionDrawer.OnMenuItemClickListener

Interface responsible for receiving menu item click events if the items themselves do not have individual item click listeners. 

Inherited constants

From class android.view.ViewGroup
From class android.view.View

Inherited fields

From class android.view.View

Public constructors

WearableActionDrawer(Context context)
WearableActionDrawer(Context context, AttributeSet attrs)
WearableActionDrawer(Context context, AttributeSet attrs, int defStyleAttr)

Public methods

boolean canScrollHorizontally(int direction)
Menu getMenu()

Returns the Menu object that this WearableActionDrawer represents.

void onPeekContainerClicked(View v)

Called when anything within the peek container is clicked.

void setOnMenuItemClickListener(WearableActionDrawer.OnMenuItemClickListener listener)

Set a WearableActionDrawer.OnMenuItemClickListener for this action drawer.

void setTitle(CharSequence title)

Sets the title for this action drawer.

Inherited methods

From class android.support.wearable.view.drawer.WearableDrawerView
From class android.widget.FrameLayout
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.view.ViewParent
From interface android.view.ViewManager
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.accessibility.AccessibilityEventSource

Public constructors

WearableActionDrawer

WearableActionDrawer (Context context)

Parameters
context Context

WearableActionDrawer

WearableActionDrawer (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

WearableActionDrawer

WearableActionDrawer (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

Public methods

canScrollHorizontally

boolean canScrollHorizontally (int direction)

Parameters
direction int

Returns
boolean

getMenu

Menu getMenu ()

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.

Returns
Menu the Menu presented by this view

onPeekContainerClicked

void onPeekContainerClicked (View v)

Called when anything within the peek container is clicked. However, if a custom peek view is supplied and it handles the click, then this may not be called. The default behavior is to open the drawer.

Parameters
v View

setOnMenuItemClickListener

void setOnMenuItemClickListener (WearableActionDrawer.OnMenuItemClickListener listener)

Set a WearableActionDrawer.OnMenuItemClickListener for this action drawer.

Parameters
listener WearableActionDrawer.OnMenuItemClickListener

setTitle

void setTitle (CharSequence title)

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

Parameters
title CharSequence

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (Dec 2017 Android Platform & Tools Survey)