public class

WearableListView

extends RecyclerView

Note: The Wearable Support Library classes under the android.support.wearable package are subject to change. For the full Android API reference, see Reference.

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.support.v7.widget.RecyclerView
         ↳ android.support.wearable.view.WearableListView

Class Overview

An alternative version of ListView that is optimized for ease of use on small screen wearable devices. It displays a vertically scrollable list of items, and automatically snaps to the nearest item when the user stops scrolling.

For a quick start, you will need to implement a subclass of WearableListView.Adapter, which will create and bind your views to the WearableListView.ViewHolder objects. If you want to add more visual treatment to your views when they become the central items of the WearableListView, have them implement the WearableListView.OnCenterProximityListener interface.

Summary

Nested Classes
class WearableListView.Adapter Base class for adapters providing data for the WearableListView. 
interface WearableListView.ClickListener Interface for listening for click events on WearableListView. 
interface WearableListView.OnCenterProximityListener Interface for receiving callbacks when WearableListView children become or cease to be the central item. 
interface WearableListView.OnScrollListener Interface for listening to WearableListView content scrolling. 
class WearableListView.ViewHolder Wrapper around items displayed in the list view. 
[Expand]
Inherited Constants
From class android.support.v7.widget.RecyclerView
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
WearableListView(Context context)
WearableListView(Context context, AttributeSet attrs)
WearableListView(Context context, AttributeSet attrs, int defStyleAttr)
Public Methods
void addOnScrollListener(WearableListView.OnScrollListener listener)
Adds a listener that will be called when the content of the list view is scrolled.
void animateToCenter()
Automatically starts an animation that snaps the list to center on the element closest to the middle.
boolean fling(int velocityX, int velocityY)
WearableListView.ViewHolder getChildViewHolder(View child)
boolean onInterceptTouchEvent(MotionEvent event)
boolean onTouchEvent(MotionEvent event)
void removeOnScrollListener(WearableListView.OnScrollListener listener)
Removes listener for scroll events.
void resetLayoutManager()
Clears the state of the layout manager that positions list items.
void setAdapter(Adapter adapter)
void setClickListener(WearableListView.ClickListener clickListener)
Adds a listener that will be called when the user taps on the WearableListView or its items.
void setGreedyTouchMode(boolean greedy)
Controls whether WearableListView should intercept all touch events and also prevent the parent from receiving them.
void setInitialOffset(int top)
By default the first element of the list is initially positioned in the center of the screen.
[Expand]
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.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

Public Constructors

public WearableListView (Context context)

public WearableListView (Context context, AttributeSet attrs)

public WearableListView (Context context, AttributeSet attrs, int defStyleAttr)

Public Methods

public void addOnScrollListener (WearableListView.OnScrollListener listener)

Adds a listener that will be called when the content of the list view is scrolled.

public void animateToCenter ()

Automatically starts an animation that snaps the list to center on the element closest to the middle.

public boolean fling (int velocityX, int velocityY)

public WearableListView.ViewHolder getChildViewHolder (View child)

public boolean onInterceptTouchEvent (MotionEvent event)

public boolean onTouchEvent (MotionEvent event)

public void removeOnScrollListener (WearableListView.OnScrollListener listener)

Removes listener for scroll events.

public void resetLayoutManager ()

Clears the state of the layout manager that positions list items.

public void setAdapter (Adapter adapter)

public void setClickListener (WearableListView.ClickListener clickListener)

Adds a listener that will be called when the user taps on the WearableListView or its items.

public void setGreedyTouchMode (boolean greedy)

Controls whether WearableListView should intercept all touch events and also prevent the parent from receiving them.

Parameters
greedy If true it will intercept all touch events.

public void setInitialOffset (int top)

By default the first element of the list is initially positioned in the center of the screen. This method allows the developer to specify a different offset, e.g. to hide the WearableListView before the user is allowed to use it.

Parameters
top How far the elements should be pushed down.