WearableNavigationDrawerView

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

Ease of use class for creating a Wearable navigation drawer. This can be used with to create a drawer for users to easily navigate a wearable app.

There are two ways this information may be presented: as a single page and as multiple pages. The single page navigation drawer will display 1-7 items to the user representing different navigation verticals. If more than 7 items are provided to a single page navigation drawer, the navigation drawer will be displayed as empty. The multiple page navigation drawer will display 1 or more pages to the user, each representing different navigation verticals.

The developer may specify which style to use with the app:navigationStyle custom attribute. If not specified, singlePage will be used as the default.

Summary

Nested classes

abstract

Listener which is notified when the user selects an item.

abstract

Adapter for specifying the contents of WearableNavigationDrawer.

Constants

static Int

Multi-page navigation drawer style.

static Int

Single page navigation drawer style.

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 Unit

Add an OnItemSelectedListener that will be notified when the user selects an item.

open Boolean

open Int

Returns the style this drawer is using, either SINGLE_PAGE or MULTI_PAGE.

open Unit

open Unit

open Boolean

open Unit

Remove an OnItemSelectedListener.

open Unit

Set a WearableNavigationDrawerAdapter that will supply data for this drawer.

open Unit
setCurrentItem(index: Int, smoothScrollTo: Boolean)

Changes which index is selected.

Inherited functions

Constants

MULTI_PAGE

static val MULTI_PAGE: Int

Multi-page navigation drawer style. Each item is on its own page. Useful when more than 7 items exist.

Value: 1

SINGLE_PAGE

static val SINGLE_PAGE: Int

Single page navigation drawer style. This is the default drawer style. It is ideal for 1-5 items, but works with up to 7 items. If more than 7 items exist, then the drawer will be displayed as empty.

Value: 0

Public constructors

<init>

WearableNavigationDrawerView(context: Context!)

<init>

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

<init>

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

<init>

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

Public methods

addOnItemSelectedListener

open fun addOnItemSelectedListener(listener: WearableNavigationDrawerView.OnItemSelectedListener!): Unit

Add an OnItemSelectedListener that will be notified when the user selects an item.

canScrollHorizontally

open fun canScrollHorizontally(direction: Int): Boolean

getNavigationStyle

open fun getNavigationStyle(): Int

Returns the style this drawer is using, either SINGLE_PAGE or MULTI_PAGE.

onDrawerClosed

open fun onDrawerClosed(): Unit

onDrawerOpened

open fun onDrawerOpened(): Unit

onInterceptTouchEvent

open fun onInterceptTouchEvent(ev: MotionEvent!): Boolean

removeOnItemSelectedListener

open fun removeOnItemSelectedListener(listener: WearableNavigationDrawerView.OnItemSelectedListener!): Unit

Remove an OnItemSelectedListener.

setAdapter

open fun setAdapter(adapter: WearableNavigationDrawerView.WearableNavigationDrawerAdapter!): Unit

Set a WearableNavigationDrawerAdapter that will supply data for this drawer.

setCurrentItem

open fun setCurrentItem(index: Int, smoothScrollTo: Boolean): Unit

Changes which index is selected. OnItemSelectedListener#onItemSelected will be called when the specified index is reached, but it won't be called for items between the current index and the destination index.