WearableDrawerView
public
class
WearableDrawerView
extends FrameLayout
java.lang.Object | ||||
↳ | android.view.View | |||
↳ | android.view.ViewGroup | |||
↳ | android.widget.FrameLayout | |||
↳ | androidx.wear.widget.drawer.WearableDrawerView |
Known direct subclasses
|
View that contains drawer content and a peeking view for use with WearableDrawerLayout
.
This view provides the ability to set its main content as well as a view shown while peeking. Specifying the peek view is entirely optional; a default is used if none are set. However, the content must be provided.
There are two ways to specify the content and peek views: by invoking setter
methods
on the WearableDrawerView
, or by specifying the app:drawerContent
and app:peekView
attributes. Examples:
// From Java: drawerView.setDrawerContent(drawerContentView); drawerView.setPeekContent(peekContentView); <!-- From XML: --> <androidx.wear.widget.drawer.WearableDrawerView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="bottom" android:background="@color/red" app:drawerContent="@+id/drawer_content" app:peekView="@+id/peek_view"> <FrameLayout android:id="@id/drawer_content" android:layout_width="match_parent" android:layout_height="match_parent" /> <LinearLayout android:id="@id/peek_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:orientation="horizontal"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@android:drawable/ic_media_play" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@android:drawable/ic_media_pause" /> </LinearLayout> </androidx.wear.widget.drawer.WearableDrawerView>
Summary
Constants | |
---|---|
int |
STATE_DRAGGING
Indicates that the drawer is currently being dragged by the user. |
int |
STATE_IDLE
Indicates that the drawer is in an idle, settled state. |
int |
STATE_SETTLING
Indicates that the drawer is in the process of settling to a final position. |
Inherited constants | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.view.ViewGroup
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From class
android.view.View
|
Inherited fields | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.view.View
|
Public constructors | |
---|---|
WearableDrawerView(Context context)
|
|
WearableDrawerView(Context context, AttributeSet attrs)
|
|
WearableDrawerView(Context context, AttributeSet attrs, int defStyleAttr)
|
|
WearableDrawerView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
|
Public methods | |
---|---|
void
|
addView(View child, int index, ViewGroup.LayoutParams params)
|
WearableDrawerController
|
getController()
Returns the |
View
|
getDrawerContent()
Returns the drawer content view. |
int
|
getDrawerState()
Returns the current drawer state, which will be one of |
boolean
|
isAutoPeekEnabled()
Returns true if this drawer has auto-peeking enabled. |
boolean
|
isClosed()
Returns true if the drawer is fully closed. |
boolean
|
isLocked()
Returns true if the position of the drawer cannot be modified by user interaction. |
boolean
|
isLockedWhenClosed()
Returns true if this drawer should be locked when the user cannot see it. |
boolean
|
isOpenOnlyAtTopEnabled()
Returns whether this drawer may only be opened by the user when at the top of the scrolling content. |
boolean
|
isOpened()
Returns true if the drawer is fully open. |
boolean
|
isPeekOnScrollDownEnabled()
Gets whether or not this drawer should peek while scrolling down. |
boolean
|
isPeeking()
Returns whether the drawer is either peeking or the peek view is animating open. |
void
|
onDrawerClosed()
Called when the drawer has settled in a completely closed state. |
void
|
onDrawerOpened()
Called when the drawer has settled in a completely open state. |
void
|
onDrawerStateChanged(int state)
Called when the drawer state changes. |
void
|
onPeekContainerClicked(View v)
Called when anything within the peek container is clicked. |
void
|
setDrawerContent(View content)
Set the drawer content view. |
void
|
setIsAutoPeekEnabled(boolean canAutoPeek)
Sets whether or not the drawer can automatically adjust its peek state. |
void
|
setIsLocked(boolean locked)
Sets whether or not the position of the drawer can be modified by user interaction. |
void
|
setLockedWhenClosed(boolean locked)
Sets whether this drawer should be locked when the user cannot see it. |
void
|
setOpenOnlyAtTopEnabled(boolean openOnlyAtTop)
Only allow the user to open this drawer when at the top of the scrolling content. |
void
|
setPeekContent(View content)
Set the peek content view. |
void
|
setPeekOnScrollDownEnabled(boolean peekOnScrollDown)
Sets whether or not this drawer should peek while scrolling down. |
Protected methods | |
---|---|
void
|
onAttachedToWindow()
|
void
|
onFinishInflate()
|
Inherited methods | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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
|
Constants
STATE_DRAGGING
public static final int STATE_DRAGGING
Indicates that the drawer is currently being dragged by the user.
Constant Value: 1 (0x00000001)
STATE_IDLE
public static final int STATE_IDLE
Indicates that the drawer is in an idle, settled state. No animation is in progress.
Constant Value: 0 (0x00000000)
STATE_SETTLING
public static final int STATE_SETTLING
Indicates that the drawer is in the process of settling to a final position.
Constant Value: 2 (0x00000002)
Public constructors
WearableDrawerView
public WearableDrawerView (Context context, AttributeSet attrs)
Parameters | |
---|---|
context |
Context |
attrs |
AttributeSet |
WearableDrawerView
public WearableDrawerView (Context context, AttributeSet attrs, int defStyleAttr)
Parameters | |
---|---|
context |
Context |
attrs |
AttributeSet |
defStyleAttr |
int |
WearableDrawerView
public WearableDrawerView (Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
Parameters | |
---|---|
context |
Context |
attrs |
AttributeSet |
defStyleAttr |
int |
defStyleRes |
int |
Public methods
addView
public void addView (View child, int index, ViewGroup.LayoutParams params)
Parameters | |
---|---|
child |
View |
index |
int |
params |
ViewGroup.LayoutParams |
getController
public WearableDrawerController getController ()
Returns the WearableDrawerController
associated with this WearableDrawerView
.
This will only be valid after this View
has been added to its parent.
Returns | |
---|---|
WearableDrawerController |
getDrawerState
public int getDrawerState ()
Returns the current drawer state, which will be one of STATE_DRAGGING
, STATE_SETTLING
, or STATE_IDLE
Returns | |
---|---|
int |
isAutoPeekEnabled
public boolean isAutoPeekEnabled ()
Returns true if this drawer has auto-peeking enabled. This will always return false
for a locked drawer.
Returns | |
---|---|
boolean |
isClosed
public boolean isClosed ()
Returns true if the drawer is fully closed.
Returns | |
---|---|
boolean |
isLocked
public boolean isLocked ()
Returns true if the position of the drawer cannot be modified by user interaction.
Specifically, a drawer cannot be opened, closed, or automatically peeked by WearableDrawerLayout
. However, it can be explicitly opened, closed, and peeked by the
developer. A drawer may be considered locked if the drawer is locked open, locked closed, or
is closed and isLockedWhenClosed()
returns true.
Returns | |
---|---|
boolean |
isLockedWhenClosed
public boolean isLockedWhenClosed ()
Returns true if this drawer should be locked when the user cannot see it.
Returns | |
---|---|
boolean |
See also:
isOpenOnlyAtTopEnabled
public boolean isOpenOnlyAtTopEnabled ()
Returns whether this drawer may only be opened by the user when at the top of the scrolling
content. If there is no scrolling content, then this has no effect. Defaults to false
.
Returns | |
---|---|
boolean |
isOpened
public boolean isOpened ()
Returns true if the drawer is fully open.
Returns | |
---|---|
boolean |
isPeekOnScrollDownEnabled
public boolean isPeekOnScrollDownEnabled ()
Gets whether or not this drawer should peek while scrolling down. This is currently only
supported for bottom drawers. Defaults to false
.
Returns | |
---|---|
boolean |
isPeeking
public boolean isPeeking ()
Returns whether the drawer is either peeking or the peek view is animating open.
Returns | |
---|---|
boolean |
onDrawerClosed
public void onDrawerClosed ()
Called when the drawer has settled in a completely closed state. This is analogous to WearableDrawerLayout.DrawerStateCallback.onDrawerClosed(WearableDrawerLayout, WearableDrawerView)
.
onDrawerOpened
public void onDrawerOpened ()
Called when the drawer has settled in a completely open state. The drawer is interactive at
this point. This is analogous to WearableDrawerLayout.DrawerStateCallback.onDrawerOpened(WearableDrawerLayout, WearableDrawerView)
.
onDrawerStateChanged
public void onDrawerStateChanged (int state)
Called when the drawer state changes. This is analogous to WearableDrawerLayout.DrawerStateCallback.onDrawerStateChanged(WearableDrawerLayout, int)
.
Parameters | |
---|---|
state |
int : one of STATE_DRAGGING , STATE_SETTLING , or STATE_IDLE
|
onPeekContainerClicked
public 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 |
setDrawerContent
public void setDrawerContent (View content)
Set the drawer content view.
Parameters | |
---|---|
content |
View : The view to show when the drawer is open, or null if it should not
open.
|
setIsAutoPeekEnabled
public void setIsAutoPeekEnabled (boolean canAutoPeek)
Sets whether or not the drawer can automatically adjust its peek state. Note that locked
drawers will never auto-peek, but their isAutoPeekEnabled
state will be maintained
through a lock/unlock cycle.
Parameters | |
---|---|
canAutoPeek |
boolean |
setIsLocked
public void setIsLocked (boolean locked)
Sets whether or not the position of the drawer can be modified by user interaction.
Parameters | |
---|---|
locked |
boolean |
See also:
setLockedWhenClosed
public void setLockedWhenClosed (boolean locked)
Sets whether this drawer should be locked when the user cannot see it.
Parameters | |
---|---|
locked |
boolean |
See also:
setOpenOnlyAtTopEnabled
public void setOpenOnlyAtTopEnabled (boolean openOnlyAtTop)
Only allow the user to open this drawer when at the top of the scrolling content. If there is
no scrolling content, then this has no effect. Defaults to false
.
Parameters | |
---|---|
openOnlyAtTop |
boolean |
setPeekContent
public void setPeekContent (View content)
Set the peek content view.
Parameters | |
---|---|
content |
View : The view to show when the drawer peeks.
|
setPeekOnScrollDownEnabled
public void setPeekOnScrollDownEnabled (boolean peekOnScrollDown)
Sets whether or not this drawer should peek while scrolling down. This is currently only
supported for bottom drawers. Defaults to false
.
Parameters | |
---|---|
peekOnScrollDown |
boolean |
Protected methods
onAttachedToWindow
protected void onAttachedToWindow ()
onFinishInflate
protected void onFinishInflate ()