public class SliderPager
extends android.view.ViewGroup
| Modifier and Type | Class and Description |
|---|---|
static interface |
SliderPager.DecorView
Annotation which allows marking of views to be decoration views when added to a view
pager.
|
static class |
SliderPager.LayoutParams
Layout parameters that should be supplied for views added to a
SliderPager.
|
static interface |
SliderPager.OnAdapterChangeListener
Callback interface for responding to adapter changes.
|
static interface |
SliderPager.OnPageChangeListener
Callback interface for responding to changing state of the selected page.
|
static interface |
SliderPager.PageTransformer
A PageTransformer is invoked whenever a visible/attached page is scrolled.
|
static class |
SliderPager.SavedState
This is the persistent state that is saved by SliderPager.
|
static class |
SliderPager.SimpleOnPageChangeListener
Simple implementation of the
##OnPageChangeListener interface with stub
implementations of each method. |
android.view.ViewGroup.MarginLayoutParams, android.view.ViewGroup.OnHierarchyChangeListenerandroid.view.View.AccessibilityDelegate, android.view.View.BaseSavedState, android.view.View.DragShadowBuilder, android.view.View.MeasureSpec, android.view.View.OnApplyWindowInsetsListener, android.view.View.OnAttachStateChangeListener, android.view.View.OnCapturedPointerListener, android.view.View.OnClickListener, android.view.View.OnContextClickListener, android.view.View.OnCreateContextMenuListener, android.view.View.OnDragListener, android.view.View.OnFocusChangeListener, android.view.View.OnGenericMotionListener, android.view.View.OnHoverListener, android.view.View.OnKeyListener, android.view.View.OnLayoutChangeListener, android.view.View.OnLongClickListener, android.view.View.OnScrollChangeListener, android.view.View.OnSystemUiVisibilityChangeListener, android.view.View.OnTouchListener, android.view.View.OnUnhandledKeyEventListener| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_SCROLL_DURATION |
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, AUTOFILL_FLAG_INCLUDE_NOT_IMPORTANT_VIEWS, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR, AUTOFILL_HINT_CREDIT_CARD_NUMBER, AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE, AUTOFILL_HINT_EMAIL_ADDRESS, AUTOFILL_HINT_NAME, AUTOFILL_HINT_PASSWORD, AUTOFILL_HINT_PHONE, AUTOFILL_HINT_POSTAL_ADDRESS, AUTOFILL_HINT_POSTAL_CODE, AUTOFILL_HINT_USERNAME, AUTOFILL_TYPE_DATE, AUTOFILL_TYPE_LIST, AUTOFILL_TYPE_NONE, AUTOFILL_TYPE_TEXT, AUTOFILL_TYPE_TOGGLE, DRAG_FLAG_GLOBAL, DRAG_FLAG_GLOBAL_PERSISTABLE_URI_PERMISSION, DRAG_FLAG_GLOBAL_PREFIX_URI_PERMISSION, DRAG_FLAG_GLOBAL_URI_READ, DRAG_FLAG_GLOBAL_URI_WRITE, DRAG_FLAG_OPAQUE, 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, FOCUSABLE, FOCUSABLE_AUTO, 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, IMPORTANT_FOR_AUTOFILL_AUTO, IMPORTANT_FOR_AUTOFILL_NO, IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS, IMPORTANT_FOR_AUTOFILL_YES, IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS, 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, NOT_FOCUSABLE, 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, SCROLL_INDICATOR_BOTTOM, SCROLL_INDICATOR_END, SCROLL_INDICATOR_LEFT, SCROLL_INDICATOR_RIGHT, SCROLL_INDICATOR_START, SCROLL_INDICATOR_TOP, 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_LIGHT_NAVIGATION_BAR, SYSTEM_UI_FLAG_LIGHT_STATUS_BAR, 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_FIRST_STRONG_LTR, TEXT_DIRECTION_FIRST_STRONG_RTL, 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| Constructor and Description |
|---|
SliderPager(android.content.Context context) |
SliderPager(android.content.Context context,
android.util.AttributeSet attrs) |
| Modifier and Type | Method and Description |
|---|---|
void |
addFocusables(java.util.ArrayList<android.view.View> views,
int direction,
int focusableMode)
We only want the current page that is being shown to be focusable.
|
void |
addOnAdapterChangeListener(SliderPager.OnAdapterChangeListener listener)
Add a listener that will be invoked whenever the adapter for this SliderPager changes.
|
void |
addOnPageChangeListener(SliderPager.OnPageChangeListener listener)
Add a listener that will be invoked whenever the page changes or is incrementally
scrolled.
|
void |
addTouchables(java.util.ArrayList<android.view.View> views)
We only want the current page that is being shown to be touchable.
|
void |
addView(android.view.View child,
int index,
android.view.ViewGroup.LayoutParams params) |
boolean |
arrowScroll(int direction)
Handle scrolling in response to a left or right arrow click.
|
boolean |
beginFakeDrag()
Start a fake drag of the pager.
|
protected boolean |
canScroll(android.view.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)
Check if this SliderPager can be scrolled horizontally in a certain direction.
|
protected boolean |
checkLayoutParams(android.view.ViewGroup.LayoutParams p) |
void |
clearOnPageChangeListeners()
Remove all listeners that are notified of any changes in scroll state or position.
|
void |
computeScroll() |
boolean |
dispatchKeyEvent(android.view.KeyEvent event) |
boolean |
dispatchPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent event) |
void |
draw(android.graphics.Canvas canvas) |
protected void |
drawableStateChanged() |
void |
endFakeDrag()
End a fake drag of the pager.
|
boolean |
executeKeyEvent(android.view.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 android.view.ViewGroup.LayoutParams |
generateDefaultLayoutParams() |
android.view.ViewGroup.LayoutParams |
generateLayoutParams(android.util.AttributeSet attrs) |
protected android.view.ViewGroup.LayoutParams |
generateLayoutParams(android.view.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(android.graphics.Canvas canvas) |
boolean |
onInterceptTouchEvent(android.view.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,
android.graphics.Rect previouslyFocusedRect)
We only want the current page that is being shown to be focusable.
|
void |
onRestoreInstanceState(android.os.Parcelable state) |
android.os.Parcelable |
onSaveInstanceState() |
protected void |
onSizeChanged(int w,
int h,
int oldw,
int oldh) |
boolean |
onTouchEvent(android.view.MotionEvent ev) |
void |
removeOnAdapterChangeListener(SliderPager.OnAdapterChangeListener listener)
Remove a listener that was previously added via
addOnAdapterChangeListener(OnAdapterChangeListener). |
void |
removeOnPageChangeListener(SliderPager.OnPageChangeListener listener)
Remove a listener that was previously added via
addOnPageChangeListener(OnPageChangeListener). |
void |
removeView(android.view.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 |
setOnPageChangeListener(SliderPager.OnPageChangeListener listener)
Deprecated.
|
void |
setPageMargin(int marginPixels)
Set the margin between pages.
|
void |
setPageMarginDrawable(android.graphics.drawable.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,
SliderPager.PageTransformer transformer)
Sets a
##PageTransformer that will be called for each attached page whenever
the scroll position is changed. |
void |
setPageTransformer(boolean reverseDrawingOrder,
SliderPager.PageTransformer transformer,
int pageLayerType)
Sets a
##PageTransformer that will be called for each attached page whenever
the scroll position is changed. |
void |
setScrollDuration(int millis) |
void |
setScrollDuration(int millis,
android.view.animation.Interpolator interpolator) |
protected boolean |
verifyDrawable(android.graphics.drawable.Drawable who) |
addChildrenForAccessibility, addKeyboardNavigationClusters, addStatesFromChildren, addView, addView, addView, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, canAnimate, childDrawableStateChanged, childHasTransientStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchApplyWindowInsets, dispatchCapturedPointerEvent, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchDrawableHotspotChanged, dispatchFinishTemporaryDetach, dispatchFreezeSelfOnly, dispatchGenericFocusedEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchPointerCaptureChanged, dispatchProvideAutofillStructure, dispatchProvideStructure, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, drawChild, endViewTransition, findFocus, findViewsWithText, focusableViewAvailable, focusSearch, gatherTransparentRegion, getAccessibilityClassName, getChildAt, getChildCount, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getClipChildren, getClipToPadding, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getNestedScrollAxes, getOverlay, getPersistentDrawingCache, getTouchscreenBlocksFocus, hasFocus, hasTransientState, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, isLayoutSuppressed, isMotionEventSplittingEnabled, isTransitionGroup, jumpDrawablesToCurrentState, layout, measureChild, measureChildren, measureChildWithMargins, notifySubtreeAccessibilityStateChanged, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onCreateDrawableState, onDescendantInvalidated, onInterceptHoverEvent, onNestedFling, onNestedPreFling, onNestedPrePerformAccessibilityAction, onNestedPreScroll, onNestedScroll, onNestedScrollAccepted, onRequestSendAccessibilityEvent, onResolvePointerIcon, onStartNestedScroll, onStopNestedScroll, onViewAdded, onViewRemoved, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeDetachedView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestSendAccessibilityEvent, requestTransparentRegion, restoreDefaultFocus, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setStaticTransformationsEnabled, setTouchscreenBlocksFocus, setTransitionGroup, shouldDelayChildPressedState, showContextMenuForChild, showContextMenuForChild, startActionModeForChild, startActionModeForChild, startLayoutAnimation, startViewTransition, suppressLayout, updateViewLayoutaddExtraDataToAccessibilityNodeInfo, addFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, addOnUnhandledKeyEventListener, animate, announceForAccessibility, autofill, autofill, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelDragAndDrop, 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, forceHasOverlappingRendering, forceLayout, generateViewId, getAccessibilityDelegate, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityPaneTitle, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAlpha, getAnimation, getAnimationMatrix, getApplicationWindowToken, getAttributeResolutionStack, getAttributeSourceResourceMap, getAutofillHints, getAutofillId, getAutofillType, getAutofillValue, getBackground, getBackgroundTintBlendMode, getBackgroundTintList, getBackgroundTintMode, getBaseline, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentCaptureSession, getContentDescription, getContext, getContextMenuInfo, getDefaultFocusHighlightEnabled, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getExplicitStyle, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusable, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintBlendMode, getForegroundTintList, getForegroundTintMode, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getHorizontalScrollbarThumbDrawable, getHorizontalScrollbarTrackDrawable, getId, getImportantForAccessibility, getImportantForAutofill, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInSurface, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineAmbientShadowColor, getOutlineProvider, getOutlineSpotShadowColor, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getPointerIcon, getResources, getRevealOnFocusHint, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getSourceLayoutResId, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemGestureExclusionRects, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTooltipText, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getTransitionAlpha, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getUniqueDrawingId, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarThumbDrawable, getVerticalScrollbarTrackDrawable, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowId, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasExplicitFocusable, hasFocusable, hasNestedScrollingParent, hasOnClickListeners, hasOverlappingRendering, hasPointerCapture, hasWindowFocus, inflate, invalidate, invalidate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityFocused, isAccessibilityHeading, isActivated, isAttachedToWindow, isClickable, isContextClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isForceDarkAllowed, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isImportantForAutofill, isInEditMode, isInLayout, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingOffsetRequired, isPaddingRelative, isPivotSet, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScreenReaderFocusable, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVisibleToUserForAutofill, keyboardNavigationClusterSearch, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAnimationEnd, onAnimationStart, onApplyWindowInsets, onCancelPendingInputEvents, onCapturedPointerEvent, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateInputConnection, onDisplayHint, onDragEvent, onDrawForeground, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onGenericMotionEvent, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onOverScrolled, onPointerCaptureChange, onPopulateAccessibilityEvent, onProvideAutofillStructure, onProvideAutofillVirtualStructure, onProvideStructure, onProvideVirtualStructure, onRtlPropertiesChanged, onScreenStateChanged, onScrollChanged, onSetAlpha, onStartTemporaryDetach, onTrackballEvent, onVisibilityAggregated, onVisibilityChanged, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performAccessibilityAction, performClick, performContextClick, performContextClick, performHapticFeedback, performHapticFeedback, performLongClick, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, releasePointerCapture, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, removeOnUnhandledKeyEventListener, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestPointerCapture, requestRectangleOnScreen, requestRectangleOnScreen, requestUnbufferedDispatch, requireViewById, resetPivot, resolveSize, resolveSizeAndState, restoreHierarchyState, saveAttributeDataForStyleable, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityHeading, setAccessibilityLiveRegion, setAccessibilityPaneTitle, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAlpha, setAnimation, setAnimationMatrix, setAutofillHints, setAutofillId, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintBlendMode, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentCaptureSession, setContentDescription, setContextClickable, setDefaultFocusHighlightEnabled, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusable, setFocusableInTouchMode, setFocusedByDefault, setForceDarkAllowed, setForeground, setForegroundGravity, setForegroundTintBlendMode, setForegroundTintList, setForegroundTintMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHorizontalScrollbarThumbDrawable, setHorizontalScrollbarTrackDrawable, setHovered, setId, setImportantForAccessibility, setImportantForAutofill, setKeepScreenOn, setKeyboardNavigationCluster, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLeftTopRightBottom, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextClusterForwardId, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnCapturedPointerListener, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineAmbientShadowColor, setOutlineProvider, setOutlineSpotShadowColor, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPointerIcon, setPressed, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScreenReaderFocusable, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollContainer, setScrollIndicators, setScrollIndicators, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setStateListAnimator, setSystemGestureExclusionRects, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTooltipText, setTop, setTouchDelegate, setTransitionAlpha, setTransitionName, setTransitionVisibility, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVerticalScrollbarThumbDrawable, setVerticalScrollbarTrackDrawable, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, showContextMenu, showContextMenu, startActionMode, startActionMode, startAnimation, startDrag, startDragAndDrop, startNestedScroll, stopNestedScroll, toString, transformMatrixToGlobal, transformMatrixToLocal, unscheduleDrawable, unscheduleDrawable, updateDragShadow, willNotCacheDrawing, willNotDrawclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcanResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, createContextMenu, getLayoutDirection, getParent, getParentForAccessibility, getTextAlignment, getTextDirection, isLayoutDirectionResolved, isLayoutRequested, isTextAlignmentResolved, isTextDirectionResolved, keyboardNavigationClusterSearch, requestFitSystemWindows, requestLayoutpublic static final int DEFAULT_SCROLL_DURATION
public static final int SCROLL_STATE_IDLE
public static final int SCROLL_STATE_DRAGGING
public static final int SCROLL_STATE_SETTLING
public SliderPager(android.content.Context context)
public SliderPager(android.content.Context context,
android.util.AttributeSet attrs)
protected void onDetachedFromWindow()
onDetachedFromWindow in class android.view.ViewGrouppublic void setAdapter(PagerAdapter adapter)
adapter - Adapter to usepublic PagerAdapter getAdapter()
public void addOnAdapterChangeListener(SliderPager.OnAdapterChangeListener listener)
listener - listener to addpublic void removeOnAdapterChangeListener(SliderPager.OnAdapterChangeListener listener)
addOnAdapterChangeListener(OnAdapterChangeListener).listener - listener to removepublic 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()
@Deprecated public void setOnPageChangeListener(SliderPager.OnPageChangeListener listener)
addOnPageChangeListener(OnPageChangeListener)
and removeOnPageChangeListener(OnPageChangeListener) instead.##OnPageChangeListener.listener - Listener to setpublic void addOnPageChangeListener(SliderPager.OnPageChangeListener listener)
##OnPageChangeListener.
Components that add a listener should take care to remove it when finished.
Other components that take ownership of a view may call clearOnPageChangeListeners()
to remove all attached listeners.
listener - listener to addpublic void removeOnPageChangeListener(SliderPager.OnPageChangeListener listener)
addOnPageChangeListener(OnPageChangeListener).listener - listener to removepublic void clearOnPageChangeListeners()
public void setPageTransformer(boolean reverseDrawingOrder,
SliderPager.PageTransformer transformer)
##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 behavior.
Note: By default, calling this method will cause contained pages to use
#View#LAYER_TYPE_HARDWARE. This layer type allows custom alpha transformations,
but it will cause issues if any of your pages contain a ##android.view.SurfaceView
and you have not called ##android.view.SurfaceView#setZOrderOnTop(boolean) to put that
##android.view.SurfaceView above your app content. To disable this behavior, call
setPageTransformer(boolean, PageTransformer, int) and pass
#View#LAYER_TYPE_NONE for pageLayerType.
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 propertiespublic void setPageTransformer(boolean reverseDrawingOrder,
SliderPager.PageTransformer transformer,
int pageLayerType)
##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 behavior.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 propertiespageLayerType - View layer type that should be used for SliderPager pages. It should be
either #View#LAYER_TYPE_HARDWARE,
#View#LAYER_TYPE_SOFTWARE, or
#View#LAYER_TYPE_NONE.protected int getChildDrawingOrder(int childCount,
int i)
getChildDrawingOrder in class android.view.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(android.graphics.drawable.Drawable d)
d - Drawable to display between pagespublic void setPageMarginDrawable(int resId)
resId - Resource ID of a drawable to display between pagesprotected boolean verifyDrawable(android.graphics.drawable.Drawable who)
verifyDrawable in class android.view.Viewpublic void setScrollDuration(int millis,
android.view.animation.Interpolator interpolator)
public void setScrollDuration(int millis)
protected void drawableStateChanged()
drawableStateChanged in class android.view.ViewGrouppublic android.os.Parcelable onSaveInstanceState()
onSaveInstanceState in class android.view.Viewpublic void onRestoreInstanceState(android.os.Parcelable state)
onRestoreInstanceState in class android.view.Viewpublic void addView(android.view.View child,
int index,
android.view.ViewGroup.LayoutParams params)
addView in class android.view.ViewGrouppublic void removeView(android.view.View view)
removeView in interface android.view.ViewManagerremoveView in class android.view.ViewGroupprotected void onAttachedToWindow()
onAttachedToWindow in class android.view.ViewGroupprotected void onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
onMeasure in class android.view.Viewprotected void onSizeChanged(int w,
int h,
int oldw,
int oldh)
onSizeChanged in class android.view.Viewprotected void onLayout(boolean changed,
int l,
int t,
int r,
int b)
onLayout in class android.view.ViewGrouppublic void computeScroll()
computeScroll in class android.view.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(android.view.MotionEvent ev)
onInterceptTouchEvent in class android.view.ViewGrouppublic boolean onTouchEvent(android.view.MotionEvent ev)
onTouchEvent in class android.view.Viewpublic void draw(android.graphics.Canvas canvas)
draw in class android.view.Viewprotected void onDraw(android.graphics.Canvas canvas)
onDraw in class android.view.Viewpublic boolean beginFakeDrag()
A fake drag can be useful if you want to synchronize the motion of the SliderPager
with the touch scrolling of another view, while still letting the SliderPager
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 SliderPager will ignore all touch events. If a real drag is already in progress, this method will return false.
fakeDragBy(float),
endFakeDrag()public void endFakeDrag()
beginFakeDrag(),
fakeDragBy(float)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 in class android.view.Viewdirection - Negative to check scrolling left, positive to check scrolling right.protected boolean canScroll(android.view.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(android.view.KeyEvent event)
dispatchKeyEvent in class android.view.ViewGrouppublic boolean executeKeyEvent(android.view.KeyEvent event)
event - The key event to execute.public boolean arrowScroll(int direction)
direction - The direction corresponding to the arrow key that was pressed. It should be
either #View#FOCUS_LEFT or #View#FOCUS_RIGHT.public void addFocusables(java.util.ArrayList<android.view.View> views,
int direction,
int focusableMode)
addFocusables in class android.view.ViewGrouppublic void addTouchables(java.util.ArrayList<android.view.View> views)
addTouchables in class android.view.ViewGroupprotected boolean onRequestFocusInDescendants(int direction,
android.graphics.Rect previouslyFocusedRect)
onRequestFocusInDescendants in class android.view.ViewGrouppublic boolean dispatchPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent event)
dispatchPopulateAccessibilityEvent in class android.view.Viewprotected android.view.ViewGroup.LayoutParams generateDefaultLayoutParams()
generateDefaultLayoutParams in class android.view.ViewGroupprotected android.view.ViewGroup.LayoutParams generateLayoutParams(android.view.ViewGroup.LayoutParams p)
generateLayoutParams in class android.view.ViewGroupprotected boolean checkLayoutParams(android.view.ViewGroup.LayoutParams p)
checkLayoutParams in class android.view.ViewGrouppublic android.view.ViewGroup.LayoutParams generateLayoutParams(android.util.AttributeSet attrs)
generateLayoutParams in class android.view.ViewGroup