public class ViewPagerEx extends ViewGroup
| 限定符和类型 | 类和说明 |
|---|---|
static class |
ViewPagerEx.LayoutParams
Layout parameters that should be supplied for views added to a
ViewPager.
|
static interface |
ViewPagerEx.OnPageChangeListener
Callback interface for responding to changing state of the selected page.
|
static interface |
ViewPagerEx.PageTransformer
A PageTransformer is invoked whenever a visible/attached page is scrolled.
|
static class |
ViewPagerEx.SavedState
This is the persistent state that is saved by ViewPager.
|
static class |
ViewPagerEx.SimpleOnPageChangeListener
Simple implementation of the
ViewPagerEx.OnPageChangeListener interface with stub
implementations of each method. |
ViewGroup.MarginLayoutParams, ViewGroup.OnHierarchyChangeListenerView.AccessibilityDelegate, View.BaseSavedState, View.DragShadowBuilder, View.MeasureSpec, View.OnApplyWindowInsetsListener, View.OnAttachStateChangeListener, View.OnClickListener, View.OnCreateContextMenuListener, View.OnDragListener, View.OnFocusChangeListener, View.OnGenericMotionListener, View.OnHoverListener, View.OnKeyListener, View.OnLayoutChangeListener, View.OnLongClickListener, View.OnSystemUiVisibilityChangeListener, View.OnTouchListener| 限定符和类型 | 字段和说明 |
|---|---|
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.
|
CLIP_TO_PADDING_MASK, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, LAYOUT_MODE_CLIP_BOUNDS, LAYOUT_MODE_OPTICAL_BOUNDS, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHEACCESSIBILITY_LIVE_REGION_ASSERTIVE, ACCESSIBILITY_LIVE_REGION_NONE, ACCESSIBILITY_LIVE_REGION_POLITE, ALPHA, DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FIND_VIEWS_WITH_CONTENT_DESCRIPTION, FIND_VIEWS_WITH_TEXT, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, IMPORTANT_FOR_ACCESSIBILITY_AUTO, IMPORTANT_FOR_ACCESSIBILITY_NO, IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS, IMPORTANT_FOR_ACCESSIBILITY_YES, INVISIBLE, KEEP_SCREEN_ON, LAYER_TYPE_HARDWARE, LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE, LAYOUT_DIRECTION_INHERIT, LAYOUT_DIRECTION_LOCALE, LAYOUT_DIRECTION_LTR, LAYOUT_DIRECTION_RTL, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, NO_ID, OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCREEN_STATE_OFF, SCREEN_STATE_ON, SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_NONE, SCROLL_AXIS_VERTICAL, SCROLLBAR_POSITION_DEFAULT, SCROLLBAR_POSITION_LEFT, SCROLLBAR_POSITION_RIGHT, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, STATUS_BAR_HIDDEN, STATUS_BAR_VISIBLE, SYSTEM_UI_FLAG_FULLSCREEN, SYSTEM_UI_FLAG_HIDE_NAVIGATION, SYSTEM_UI_FLAG_IMMERSIVE, SYSTEM_UI_FLAG_IMMERSIVE_STICKY, SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN, SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_STABLE, SYSTEM_UI_FLAG_LOW_PROFILE, SYSTEM_UI_FLAG_VISIBLE, SYSTEM_UI_LAYOUT_FLAGS, TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_GRAVITY, TEXT_ALIGNMENT_INHERIT, TEXT_ALIGNMENT_TEXT_END, TEXT_ALIGNMENT_TEXT_START, TEXT_ALIGNMENT_VIEW_END, TEXT_ALIGNMENT_VIEW_START, TEXT_DIRECTION_ANY_RTL, TEXT_DIRECTION_FIRST_STRONG, TEXT_DIRECTION_INHERIT, TEXT_DIRECTION_LOCALE, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, TRANSLATION_X, TRANSLATION_Y, TRANSLATION_Z, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y, Z| 构造器和说明 |
|---|
ViewPagerEx(Context context) |
ViewPagerEx(Context context,
AttributeSet attrs) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addFocusables(ArrayList<View> views,
int direction,
int focusableMode)
We only want the current page that is being shown to be focusable.
|
void |
addOnPageChangeListener(ViewPagerEx.OnPageChangeListener listener)
Add a listener that will be invoked whenever the page changes or is incrementally
scrolled.
|
void |
addTouchables(ArrayList<View> views)
We only want the current page that is being shown to be touchable.
|
void |
addView(View child,
int index,
ViewGroup.LayoutParams params) |
boolean |
arrowScroll(int direction) |
boolean |
beginFakeDrag()
Start a fake drag of the pager.
|
protected boolean |
canScroll(View v,
boolean checkV,
int dx,
int x,
int y)
Tests scrollability within child views of v given a delta of dx.
|
boolean |
canScrollHorizontally(int direction) |
protected boolean |
checkLayoutParams(ViewGroup.LayoutParams p) |
void |
computeScroll() |
boolean |
dispatchKeyEvent(KeyEvent event) |
boolean |
dispatchPopulateAccessibilityEvent(AccessibilityEvent event) |
void |
draw(Canvas canvas) |
protected void |
drawableStateChanged() |
void |
endFakeDrag()
End a fake drag of the pager.
|
boolean |
executeKeyEvent(KeyEvent event)
You can call this function yourself to have the scroll view perform
scrolling from a key event, just as if the event had been dispatched to
it by the view hierarchy.
|
void |
fakeDragBy(float xOffset)
Fake drag by an offset in pixels.
|
protected ViewGroup.LayoutParams |
generateDefaultLayoutParams() |
ViewGroup.LayoutParams |
generateLayoutParams(AttributeSet attrs) |
protected ViewGroup.LayoutParams |
generateLayoutParams(ViewGroup.LayoutParams p) |
PagerAdapter |
getAdapter()
Retrieve the current adapter supplying pages.
|
protected int |
getChildDrawingOrder(int childCount,
int i) |
int |
getCurrentItem() |
int |
getOffscreenPageLimit()
Returns the number of pages that will be retained to either side of the
current page in the view hierarchy in an idle state.
|
int |
getPageMargin()
Return the margin between pages.
|
boolean |
isFakeDragging()
Returns true if a fake drag is in progress.
|
protected void |
onAttachedToWindow() |
protected void |
onDetachedFromWindow() |
protected void |
onDraw(Canvas canvas) |
boolean |
onInterceptTouchEvent(MotionEvent ev) |
protected void |
onLayout(boolean changed,
int l,
int t,
int r,
int b) |
protected void |
onMeasure(int widthMeasureSpec,
int heightMeasureSpec) |
protected void |
onPageScrolled(int position,
float offset,
int offsetPixels)
This method will be invoked when the current page is scrolled, either as part
of a programmatically initiated smooth scroll or a user initiated touch scroll.
|
protected boolean |
onRequestFocusInDescendants(int direction,
Rect previouslyFocusedRect)
We only want the current page that is being shown to be focusable.
|
void |
onRestoreInstanceState(Parcelable state) |
Parcelable |
onSaveInstanceState() |
protected void |
onSizeChanged(int w,
int h,
int oldw,
int oldh) |
boolean |
onTouchEvent(MotionEvent ev) |
void |
removeOnPageChangeListener(ViewPagerEx.OnPageChangeListener listener)
Remove a listener that was added with addOnPageChangeListener
See
ViewPagerEx.OnPageChangeListener. |
void |
removeView(View view) |
void |
setAdapter(PagerAdapter adapter)
Set a PagerAdapter that will supply views for this pager as needed.
|
void |
setCurrentItem(int item)
Set the currently selected page.
|
void |
setCurrentItem(int item,
boolean smoothScroll)
Set the currently selected page.
|
void |
setOffscreenPageLimit(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 |
setPageMargin(int marginPixels)
Set the margin between pages.
|
void |
setPageMarginDrawable(Drawable d)
Set a drawable that will be used to fill the margin between pages.
|
void |
setPageMarginDrawable(int resId)
Set a drawable that will be used to fill the margin between pages.
|
void |
setPageTransformer(boolean reverseDrawingOrder,
ViewPagerEx.PageTransformer transformer)
Set a
ViewPagerEx.PageTransformer that will be called for each attached page whenever
the scroll position is changed. |
protected boolean |
verifyDrawable(Drawable who) |
addChildrenForAccessibility, addStatesFromChildren, addView, addView, addView, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, canAnimate, childDrawableStateChanged, childHasTransientStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchApplyWindowInsets, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchDrawableHotspotChanged, dispatchFreezeSelfOnly, dispatchGenericFocusedEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchSystemUiVisibilityChanged, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, drawChild, endViewTransition, findFocus, findViewsWithText, focusableViewAvailable, focusSearch, gatherTransparentRegion, getChildAt, getChildCount, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getClipChildren, getClipToPadding, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getNestedScrollAxes, getOverlay, getPersistentDrawingCache, getTouchscreenBlocksFocus, hasFocus, hasFocusable, hasTransientState, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, isMotionEventSplittingEnabled, isTransitionGroup, jumpDrawablesToCurrentState, layout, measureChild, measureChildren, measureChildWithMargins, notifySubtreeAccessibilityStateChanged, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAnimationEnd, onAnimationStart, onCreateDrawableState, onInterceptHoverEvent, onNestedFling, onNestedPreFling, onNestedPrePerformAccessibilityAction, onNestedPreScroll, onNestedScroll, onNestedScrollAccepted, onRequestSendAccessibilityEvent, onStartNestedScroll, onStopNestedScroll, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeDetachedView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestSendAccessibilityEvent, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setStaticTransformationsEnabled, setTouchscreenBlocksFocus, setTransitionGroup, shouldDelayChildPressedState, showContextMenuForChild, startActionModeForChild, startLayoutAnimation, startViewTransition, updateViewLayoutaddFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, animate, announceForAccessibility, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelLongPress, cancelPendingInputEvents, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollVertically, checkInputConnectionProxy, clearAnimation, combineMeasuredStates, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeSystemWindowInsets, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, drawableHotspotChanged, findViewById, findViewWithTag, fitSystemWindows, focusSearch, forceLayout, generateViewId, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAlpha, getAnimation, getApplicationWindowToken, getBackground, getBackgroundTintList, getBackgroundTintMode, getBaseline, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getClipBounds, getClipToOutline, getContentDescription, getContext, getContextMenuInfo, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusables, getFocusedRect, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getImportantForAccessibility, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineProvider, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getResources, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowId, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasNestedScrollingParent, hasOnClickListeners, hasOverlappingRendering, hasWindowFocus, inflate, invalidate, invalidate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityFocused, isActivated, isAttachedToWindow, isClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isInEditMode, isInLayout, isInTouchMode, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingOffsetRequired, isPaddingRelative, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onApplyWindowInsets, onCancelPendingInputEvents, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateInputConnection, onDisplayHint, onDragEvent, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onGenericMotionEvent, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onOverScrolled, onPopulateAccessibilityEvent, onRtlPropertiesChanged, onScreenStateChanged, onScrollChanged, onSetAlpha, onStartTemporaryDetach, onTrackballEvent, onVisibilityChanged, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performAccessibilityAction, performClick, performHapticFeedback, performHapticFeedback, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, requestUnbufferedDispatch, resolveSize, resolveSizeAndState, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityLiveRegion, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAlpha, setAnimation, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentDescription, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setImportantForAccessibility, setKeepScreenOn, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineProvider, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPressed, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollContainer, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setStateListAnimator, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTop, setTouchDelegate, setTransitionName, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, showContextMenu, startActionMode, startAnimation, startDrag, startNestedScroll, stopNestedScroll, toString, unscheduleDrawable, unscheduleDrawable, willNotCacheDrawing, willNotDrawclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcanResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, createContextMenu, getLayoutDirection, getParent, getParentForAccessibility, getTextAlignment, getTextDirection, isLayoutDirectionResolved, isLayoutRequested, isTextAlignmentResolved, isTextDirectionResolved, requestFitSystemWindows, requestLayoutpublic static final int SCROLL_STATE_IDLE
public static final int SCROLL_STATE_DRAGGING
public static final int SCROLL_STATE_SETTLING
public ViewPagerEx(Context context)
public ViewPagerEx(Context context, AttributeSet attrs)
protected void onDetachedFromWindow()
onDetachedFromWindow 在类中 ViewGrouppublic void setAdapter(PagerAdapter adapter)
adapter - Adapter to usepublic PagerAdapter getAdapter()
public void setCurrentItem(int item)
item - Item index to selectpublic void setCurrentItem(int item,
boolean smoothScroll)
item - Item index to selectsmoothScroll - True to smoothly scroll to the new item, false to transition immediatelypublic int getCurrentItem()
public void addOnPageChangeListener(ViewPagerEx.OnPageChangeListener listener)
ViewPagerEx.OnPageChangeListener.listener - Listener to addpublic void removeOnPageChangeListener(ViewPagerEx.OnPageChangeListener listener)
ViewPagerEx.OnPageChangeListener.listener - Listener to removepublic void setPageTransformer(boolean reverseDrawingOrder,
ViewPagerEx.PageTransformer transformer)
ViewPagerEx.PageTransformer that will be called for each attached page whenever
the scroll position is changed. This allows the application to apply custom property
transformations to each page, overriding the default sliding look and feel.
Note: Prior to Android 3.0 the property animation APIs did not exist. As a result, setting a PageTransformer prior to Android 3.0 (API 11) will have no effect.
reverseDrawingOrder - true if the supplied PageTransformer requires page views
to be drawn from last to first instead of first to last.transformer - PageTransformer that will modify each page's animation propertiesprotected int getChildDrawingOrder(int childCount,
int i)
getChildDrawingOrder 在类中 ViewGrouppublic int getOffscreenPageLimit()
setOffscreenPageLimit(int)public void setOffscreenPageLimit(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 setPageMargin(int marginPixels)
marginPixels - Distance between adjacent pages in pixelsgetPageMargin(),
setPageMarginDrawable(Drawable),
setPageMarginDrawable(int)public int getPageMargin()
public void setPageMarginDrawable(Drawable d)
d - Drawable to display between pagespublic void setPageMarginDrawable(int resId)
resId - Resource ID of a drawable to display between pagesprotected boolean verifyDrawable(Drawable who)
verifyDrawable 在类中 Viewprotected void drawableStateChanged()
drawableStateChanged 在类中 ViewGrouppublic Parcelable onSaveInstanceState()
onSaveInstanceState 在类中 Viewpublic void onRestoreInstanceState(Parcelable state)
onRestoreInstanceState 在类中 Viewpublic void addView(View child, int index, ViewGroup.LayoutParams params)
public void removeView(View view)
removeView 在接口中 ViewManagerremoveView 在类中 ViewGroupprotected void onAttachedToWindow()
onAttachedToWindow 在类中 ViewGroupprotected void onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
protected void onSizeChanged(int w,
int h,
int oldw,
int oldh)
onSizeChanged 在类中 Viewprotected void onLayout(boolean changed,
int l,
int t,
int r,
int b)
public void computeScroll()
computeScroll 在类中 Viewprotected void onPageScrolled(int position,
float offset,
int offsetPixels)
position - Position index of the first page currently being displayed.
Page position+1 will be visible if positionOffset is nonzero.offset - Value from [0, 1) indicating the offset from the page at position.offsetPixels - Value in pixels indicating the offset from position.public boolean onInterceptTouchEvent(MotionEvent ev)
onInterceptTouchEvent 在类中 ViewGrouppublic boolean onTouchEvent(MotionEvent ev)
onTouchEvent 在类中 Viewpublic boolean beginFakeDrag()
A fake drag can be useful if you want to synchronize the motion of the ViewPager
with the touch scrolling of another view, while still letting the ViewPager
control the snapping motion and fling behavior. (e.g. parallax-scrolling tabs.)
Call fakeDragBy(float) to simulate the actual drag motion. Call
endFakeDrag() to complete the fake drag and fling as necessary.
During a fake drag the ViewPager will ignore all touch events. If a real drag is already in progress, this method will return false.
fakeDragBy(float),
endFakeDrag()public void endFakeDrag()
public void fakeDragBy(float xOffset)
beginFakeDrag() first.xOffset - Offset in pixels to drag by.beginFakeDrag(),
endFakeDrag()public boolean isFakeDragging()
beginFakeDrag(),
fakeDragBy(float),
endFakeDrag()public boolean canScrollHorizontally(int direction)
canScrollHorizontally 在类中 Viewprotected boolean canScroll(View v, boolean checkV, int dx, int x, int y)
v - View to test for horizontal scrollabilitycheckV - Whether the view v passed should itself be checked for scrollability (true),
or just its children (false).dx - Delta scrolled in pixelsx - X coordinate of the active touch pointy - Y coordinate of the active touch pointpublic boolean dispatchKeyEvent(KeyEvent event)
dispatchKeyEvent 在类中 ViewGrouppublic boolean executeKeyEvent(KeyEvent event)
event - The key event to execute.public boolean arrowScroll(int direction)
public void addFocusables(ArrayList<View> views, int direction, int focusableMode)
addFocusables 在类中 ViewGrouppublic void addTouchables(ArrayList<View> views)
addTouchables 在类中 ViewGroupprotected boolean onRequestFocusInDescendants(int direction,
Rect previouslyFocusedRect)
onRequestFocusInDescendants 在类中 ViewGrouppublic boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event)
protected ViewGroup.LayoutParams generateDefaultLayoutParams()
generateDefaultLayoutParams 在类中 ViewGroupprotected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p)
generateLayoutParams 在类中 ViewGroupprotected boolean checkLayoutParams(ViewGroup.LayoutParams p)
checkLayoutParams 在类中 ViewGrouppublic ViewGroup.LayoutParams generateLayoutParams(AttributeSet attrs)
generateLayoutParams 在类中 ViewGroup