Is it possible to set the menu (actionMenu
) of a WearableActionDrawerView
in code?
<android.support.wear.widget.drawer.WearableActionDrawerView
android:id="@+id/drawer_action"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:actionMenu="@menu/menu_drawer"
/>
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:
<android.support.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(int, Menu). Example:
Menu menu = actionDrawer.getMenu(); getMenuInflater().inflate(R.menu.action_drawer, menu);