|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectViewGroup
android.support.wearable.view.GridViewPager
public class GridViewPager
Layout manager that allows the user to both vertically and horizontally through pages of data.
You supply an implementation of a GridPagerAdapter to generate the pages that the view
shows.
| Nested Class Summary | |
|---|---|
static class |
GridViewPager.LayoutParams
Layout parameters that should be supplied for views added to a ViewPager. |
static interface |
GridViewPager.OnAdapterChangeListener
Used internally to monitor when adapters are switched. |
static interface |
GridViewPager.OnPageChangeListener
Callback interface for responding to changing state of the selected page. |
| Field Summary | |
|---|---|
static int |
SCROLL_STATE_CONTENT_SETTLING
|
static int |
SCROLL_STATE_DRAGGING
Indicates that the pager is currently being dragged by the user. |
static int |
SCROLL_STATE_IDLE
Indicates that the pager is in an idle, settled state. |
static int |
SCROLL_STATE_SETTLING
Indicates that the pager is in the process of settling to a final position. |
| Constructor Summary | |
|---|---|
GridViewPager(Context context)
|
|
GridViewPager(Context context,
AttributeSet attrs)
|
|
GridViewPager(Context context,
AttributeSet attrs,
int defStyle)
|
|
| Method Summary | |
|---|---|
void |
addView(View child,
int index,
ViewGroup.LayoutParams params)
|
boolean |
canScrollHorizontally(int direction)
|
boolean |
canScrollVertically(int direction)
|
protected boolean |
checkLayoutParams(ViewGroup.LayoutParams p)
|
void |
computeScroll()
|
void |
debug()
|
protected void |
debug(int depth)
|
protected static java.lang.String |
debugIndent(int depth)
|
boolean |
dispatchKeyEvent(KeyEvent event)
|
protected ViewGroup.LayoutParams |
generateDefaultLayoutParams()
|
ViewGroup.LayoutParams |
generateLayoutParams(AttributeSet attrs)
|
protected ViewGroup.LayoutParams |
generateLayoutParams(ViewGroup.LayoutParams p)
|
GridPagerAdapter |
getAdapter()
|
Point |
getCurrentItem()
|
int |
getOffscreenPageCount()
Returns the number of pages that will be retained on the sides of the current page in the view hierarchy in an idle state. |
int |
getPageColumnMargin()
Return the margin between columns of pages. |
int |
getPageRowMargin()
Returns the margin between rows of pages. |
protected void |
measureChild(View child,
GridViewPager.LayoutParams lp)
Used to measure all page views. |
WindowInsets |
onApplyWindowInsets(WindowInsets insets)
|
void |
onAttachedToWindow()
|
protected void |
onDetachedFromWindow()
|
boolean |
onInterceptTouchEvent(MotionEvent ev)
|
protected void |
onLayout(boolean changed,
int l,
int t,
int r,
int b)
|
protected void |
onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
|
void |
onRestoreInstanceState(Parcelable state)
|
Parcelable |
onSaveInstanceState()
|
protected void |
onSizeChanged(int w,
int h,
int oldw,
int oldh)
|
boolean |
onTouchEvent(MotionEvent ev)
|
void |
removeView(View view)
|
void |
requestFitSystemWindows()
|
void |
scrollTo(int x,
int y)
|
void |
setAdapter(GridPagerAdapter adapter)
Assigns an adapter to provide the content for this pager. |
void |
setCurrentItem(int row,
int column)
Set the currently selected page. |
void |
setCurrentItem(int row,
int column,
boolean smoothScroll)
Set the currently selected page. |
void |
setOffscreenPageCount(int limit)
Set the number of pages that should be retained to either side of the current page in the view hierarchy in an idle state. |
void |
setOnAdapterChangeListener(GridViewPager.OnAdapterChangeListener listener)
|
void |
setOnPageChangeListener(GridViewPager.OnPageChangeListener listener)
Set a listener that will be invoked whenever the page changes or is incrementally scrolled. |
void |
setPageMargins(int rowMarginPx,
int columnMarginPx)
Sets the margin between pages. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int SCROLL_STATE_IDLE
public static final int SCROLL_STATE_DRAGGING
public static final int SCROLL_STATE_SETTLING
public static final int SCROLL_STATE_CONTENT_SETTLING
| Constructor Detail |
|---|
public GridViewPager(Context context)
public GridViewPager(Context context,
AttributeSet attrs)
public GridViewPager(Context context,
AttributeSet attrs,
int defStyle)
| Method Detail |
|---|
public void onAttachedToWindow()
public WindowInsets onApplyWindowInsets(WindowInsets insets)
public void requestFitSystemWindows()
protected void onDetachedFromWindow()
public void setAdapter(GridPagerAdapter adapter)
adapter - the adapter to assign
public void scrollTo(int x,
int y)
public GridPagerAdapter getAdapter()
public void setOnAdapterChangeListener(GridViewPager.OnAdapterChangeListener listener)
public void setCurrentItem(int row,
int column)
item - Item index to select
public void setCurrentItem(int row,
int column,
boolean smoothScroll)
item - Item index to selectsmoothScroll - True to smoothly scroll to the new item, false to transition immediatelypublic Point getCurrentItem()
public void setOnPageChangeListener(GridViewPager.OnPageChangeListener listener)
GridViewPager.OnPageChangeListener.
listener - Listener to setpublic int getOffscreenPageCount()
#setOffscreenPageLimit(int)public void setOffscreenPageCount(int limit)
This is offered as an optimization. If you know in advance the number of pages you will need to support or have lazy-loading mechanisms in place on your pages, tweaking this setting can have benefits in perceived smoothness of paging animations and interaction. If you have a small number of pages (3-4) that you can keep active all at once, less time will be spent in layout for newly created view subtrees as the user pages back and forth.
You should keep this limit low, especially if your pages have complex layouts. This setting defaults to 1.
limit - How many pages will be kept offscreen in an idle state.
public void setPageMargins(int rowMarginPx,
int columnMarginPx)
rowMarginPx - vertical distance between adjacent pages in pixelscolumnMarginPx - horizontal distance between adjacent pages in pixelspublic int getPageRowMargin()
public int getPageColumnMargin()
public Parcelable onSaveInstanceState()
public void onRestoreInstanceState(Parcelable state)
public void addView(View child,
int index,
ViewGroup.LayoutParams params)
public void removeView(View view)
protected void onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
protected void measureChild(View child,
GridViewPager.LayoutParams lp)
protected void onSizeChanged(int w,
int h,
int oldw,
int oldh)
protected void onLayout(boolean changed,
int l,
int t,
int r,
int b)
public void computeScroll()
public boolean onInterceptTouchEvent(MotionEvent ev)
public boolean onTouchEvent(MotionEvent ev)
public boolean canScrollHorizontally(int direction)
public boolean canScrollVertically(int direction)
public boolean dispatchKeyEvent(KeyEvent event)
protected ViewGroup.LayoutParams generateDefaultLayoutParams()
protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p)
protected boolean checkLayoutParams(ViewGroup.LayoutParams p)
public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attrs)
public void debug()
protected void debug(int depth)
protected static java.lang.String debugIndent(int depth)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||