Skip to content

Most visited

Recently visited

navigation

WearableRecyclerView

public class WearableRecyclerView
extends RecyclerView

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.support.v7.widget.RecyclerView
         ↳ android.support.wear.widget.WearableRecyclerView


Wearable specific implementation of the RecyclerView enabling setCircularScrollingGestureEnabled(boolean) circular scrolling} and semi-circular layouts.

See also:

Summary

Inherited XML attributes

From class android.support.v7.widget.RecyclerView
From class android.view.ViewGroup
From class android.view.View

Inherited constants

From class android.support.v7.widget.RecyclerView
From class android.view.ViewGroup
From class android.view.View

Inherited fields

From class android.view.View

Public constructors

WearableRecyclerView(Context context)
WearableRecyclerView(Context context, AttributeSet attrs)
WearableRecyclerView(Context context, AttributeSet attrs, int defStyle)
WearableRecyclerView(Context context, AttributeSet attrs, int defStyle, int defStyleRes)

Public methods

float getBezelFraction()

Returns the current bezel width for circular scrolling as a fraction of the screen's radius.

float getScrollDegreesPerScreen()

Returns how many degrees does the user have to rotate for to scroll through one screen height.

boolean isCircularScrollingGestureEnabled()

Returns whether circular scrolling is enabled for this view.

boolean isEdgeItemsCenteringEnabled()

Returns whether the view is currently configured to center the edge children.

boolean onTouchEvent(MotionEvent event)

Implement this method to handle touch screen motion events.

void setBezelFraction(float fraction)

Taps within this radius and the radius of the screen are considered close enough to the bezel to be candidates for circular scrolling.

void setCircularScrollingGestureEnabled(boolean circularScrollingGestureEnabled)

Enables/disables circular touch scrolling for this view.

void setEdgeItemsCenteringEnabled(boolean isEnabled)

Use this method to configure the WearableRecyclerView to always align the first and last items with the vertical center of the screen.

void setScrollDegreesPerScreen(float degreesPerScreen)

Sets how many degrees the user has to rotate by to scroll through one screen height when they are using the circular scrolling gesture.The default value equates 180 degrees scroll to one screen.

Protected methods

void onAttachedToWindow()

This is called when the view is attached to a window.

void onDetachedFromWindow()

This is called when the view is detached from a window.

Inherited methods

From class android.support.v7.widget.RecyclerView
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.support.v4.view.ScrollingView
From interface android.support.v4.view.NestedScrollingChild2
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
From interface android.support.v4.view.NestedScrollingChild

Public constructors

WearableRecyclerView

added in version 26.0.0
WearableRecyclerView (Context context)

Parameters
context Context

WearableRecyclerView

added in version 26.0.0
WearableRecyclerView (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

WearableRecyclerView

added in version 26.0.0
WearableRecyclerView (Context context, 
                AttributeSet attrs, 
                int defStyle)

Parameters
context Context

attrs AttributeSet

defStyle int

WearableRecyclerView

added in version 26.0.0
WearableRecyclerView (Context context, 
                AttributeSet attrs, 
                int defStyle, 
                int defStyleRes)

Parameters
context Context

attrs AttributeSet

defStyle int

defStyleRes int

Public methods

getBezelFraction

added in version 26.0.0
float getBezelFraction ()

Returns the current bezel width for circular scrolling as a fraction of the screen's radius.

Returns
float

See also:

getScrollDegreesPerScreen

added in version 26.0.0
float getScrollDegreesPerScreen ()

Returns how many degrees does the user have to rotate for to scroll through one screen height.

Returns
float

See also:

isCircularScrollingGestureEnabled

added in version 26.0.0
boolean isCircularScrollingGestureEnabled ()

Returns whether circular scrolling is enabled for this view.

Returns
boolean

See also:

isEdgeItemsCenteringEnabled

added in version 26.0.0
boolean isEdgeItemsCenteringEnabled ()

Returns whether the view is currently configured to center the edge children. See setEdgeItemsCenteringEnabled(boolean) for details.

Returns
boolean

onTouchEvent

boolean onTouchEvent (MotionEvent event)

Implement this method to handle touch screen motion events.

If this method is used to detect click actions, it is recommended that the actions be performed by implementing and calling performClick(). This will ensure consistent system behavior, including:

  • obeying click sound preferences
  • dispatching OnClickListener calls
  • handling ACTION_CLICK when accessibility features are enabled

Parameters
event MotionEvent: The motion event.

Returns
boolean True if the event was handled, false otherwise.

setBezelFraction

added in version 26.0.0
void setBezelFraction (float fraction)

Taps within this radius and the radius of the screen are considered close enough to the bezel to be candidates for circular scrolling. Expressed as a fraction of the screen's radius. The default is the whole screen i.e 1.0f.

Parameters
fraction float

setCircularScrollingGestureEnabled

added in version 26.0.0
void setCircularScrollingGestureEnabled (boolean circularScrollingGestureEnabled)

Enables/disables circular touch scrolling for this view. When enabled, circular touch gestures around the edge of the screen will cause the view to scroll up or down. Related methods let you specify the characteristics of the scrolling, like the speed of the scroll or the are considered for the start of this scrolling gesture.

Parameters
circularScrollingGestureEnabled boolean

See also:

setEdgeItemsCenteringEnabled

added in version 26.0.0
void setEdgeItemsCenteringEnabled (boolean isEnabled)

Use this method to configure the WearableRecyclerView to always align the first and last items with the vertical center of the screen. This effectively moves the start and end of the list to the middle of the screen if the user has scrolled so far. It takes the height of the children into account so that they are correctly centered.

Parameters
isEnabled boolean: set to true if you wish to align the edge children (first and last) with the center of the screen.

setScrollDegreesPerScreen

added in version 26.0.0
void setScrollDegreesPerScreen (float degreesPerScreen)

Sets how many degrees the user has to rotate by to scroll through one screen height when they are using the circular scrolling gesture.The default value equates 180 degrees scroll to one screen.

Parameters
degreesPerScreen float: the number of degrees to rotate by to scroll through one whole height of the screen,

See also:

Protected methods

onAttachedToWindow

void onAttachedToWindow ()

This is called when the view is attached to a window. At this point it has a Surface and will start drawing. Note that this function is guaranteed to be called before onDraw(android.graphics.Canvas), however it may be called any time before the first onDraw -- including before or after onMeasure(int, int).

onDetachedFromWindow

void onDetachedFromWindow ()

This is called when the view is detached from a window. At this point it no longer has a surface for drawing.

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!

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.
(Sep 2017 survey)