public class

PagedView

extends ViewGroup
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ greendroid.widget.PagedView

Class Overview

A View that shows items in a "paged" manner. Pages can be scrolled horizontally by swiping the View. The PagedView uses a reuse mechanism similar to the one used by the ListView widget. Pages come from a PagedAdapter.

Clients may listen to PagedView changes (scrolling, page change, etc.) using an PagedView.OnPagedViewChangeListener .

It is usually a good idea to show the user which page is currently on screen. This can be easily done with a PageIndicator.

Summary

Nested Classes
interface PagedView.OnPagedViewChangeListener Clients may listen to changes occurring on a PagedView via this interface. 
[Expand]
Inherited Constants
From class android.view.ViewGroup
From class android.view.View
Public Constructors
PagedView(Context context)
PagedView(Context context, AttributeSet attrs)
PagedView(Context context, AttributeSet attrs, int defStyle)
Public Methods
int getCurrentPage()
Returns the current page.
boolean onInterceptTouchEvent(MotionEvent ev)
void onRestoreInstanceState(Parcelable state)
Parcelable onSaveInstanceState()
boolean onTouchEvent(MotionEvent ev)
void scrollToNext()
Instantly moves to the next page
void scrollToPage(int page)
Instantly moves the PagedView from the current position to the given page.
void scrollToPrevious()
Instantly moves to the previous page
void setAdapter(PagedAdapter adapter)
Sets the PagedAdapter used to fill this PagedView with some basic information : the number of displayed pages, the pages, etc.
void setOnPageChangeListener(PagedView.OnPagedViewChangeListener listener)
Set a listener to be notified of changes that may occur in this PagedView.
void smoothScrollToNext()
Initiate an animated scrolling to the next page
void smoothScrollToPage(int page)
Initiate an animated scrolling from the current position to the given page
void smoothScrollToPrevious()
Initiate an animated scrolling to the previous page
Protected Methods
void onLayout(boolean changed, int l, int t, int r, int b)
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
void onSizeChanged(int w, int h, int oldw, int oldh)
[Expand]
Inherited Methods
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.ViewManager
From interface android.view.ViewParent
From interface android.view.accessibility.AccessibilityEventSource

Public Constructors

public PagedView (Context context)

public PagedView (Context context, AttributeSet attrs)

public PagedView (Context context, AttributeSet attrs, int defStyle)

Public Methods

public int getCurrentPage ()

Returns the current page.

Returns
  • The current page

public boolean onInterceptTouchEvent (MotionEvent ev)

public void onRestoreInstanceState (Parcelable state)

public Parcelable onSaveInstanceState ()

public boolean onTouchEvent (MotionEvent ev)

public void scrollToNext ()

Instantly moves to the next page

public void scrollToPage (int page)

Instantly moves the PagedView from the current position to the given page.

Parameters
page The page to scroll to.

public void scrollToPrevious ()

Instantly moves to the previous page

public void setAdapter (PagedAdapter adapter)

Sets the PagedAdapter used to fill this PagedView with some basic information : the number of displayed pages, the pages, etc.

Parameters
adapter The PagedAdapter to set to this PagedView

public void setOnPageChangeListener (PagedView.OnPagedViewChangeListener listener)

Set a listener to be notified of changes that may occur in this PagedView.

Parameters
listener The listener to callback.

public void smoothScrollToNext ()

Initiate an animated scrolling to the next page

public void smoothScrollToPage (int page)

Initiate an animated scrolling from the current position to the given page

Parameters
page The page to scroll to.

public void smoothScrollToPrevious ()

Initiate an animated scrolling to the previous page

Protected Methods

protected void onLayout (boolean changed, int l, int t, int r, int b)

protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)

protected void onSizeChanged (int w, int h, int oldw, int oldh)