WearableActionDrawerView
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 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
app:actionMenuattribute 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 withinflate. 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(context: Context!) |
WearableActionDrawerView(context: Context!, attrs: AttributeSet!) |
WearableActionDrawerView( |
WearableActionDrawerView( |
Public functions |
|
|---|---|
Boolean |
canScrollHorizontally(direction: Int) |
Menu! |
getMenu()Returns the Menu object that this WearableActionDrawer represents. |
Unit |
Called when the drawer has settled in a completely open state. |
Unit |
Called when anything within the peek container is clicked. |
Unit |
Set a |
Unit |
setTitle(title: CharSequence?)Sets the title for this action drawer. |
Inherited Constants |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Public constructors
WearableActionDrawerView
WearableActionDrawerView(context: Context!, attrs: AttributeSet!)
WearableActionDrawerView
WearableActionDrawerView(
context: Context!,
attrs: AttributeSet!,
defStyleAttr: Int
)
WearableActionDrawerView
WearableActionDrawerView(
context: Context!,
attrs: AttributeSet!,
defStyleAttr: Int,
defStyleRes: Int
)
Public functions
getMenu
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.
| Returns | |
|---|---|
Menu! |
the Menu presented by this view |
onDrawerOpened
fun onDrawerOpened(): Unit
Called when the drawer has settled in a completely open state. The drawer is interactive at this point. This is analogous to onDrawerOpened.
onPeekContainerClicked
fun onPeekContainerClicked(v: View!): Unit
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.
setOnMenuItemClickListener
fun setOnMenuItemClickListener(listener: MenuItem.OnMenuItemClickListener!): Unit
Set a OnMenuItemClickListener for this action drawer.
setTitle
fun setTitle(title: CharSequence?): Unit
Sets the title for this action drawer. If title is null, then the title will be removed.