SwipeRefreshLayout


class SwipeRefreshLayout : ViewGroup, NestedScrollingParent3, NestedScrollingParent2, NestedScrollingChild3, NestedScrollingChild2, NestedScrollingParent, NestedScrollingChild


The SwipeRefreshLayout should be used whenever the user can refresh the contents of a view via a vertical swipe gesture. The activity that instantiates this view should add an OnRefreshListener to be notified whenever the swipe to refresh gesture is completed. The SwipeRefreshLayout will notify the listener each and every time the gesture is completed again; the listener is responsible for correctly determining when to actually initiate a refresh of its content. If the listener determines there should not be a refresh, it must call setRefreshing(false) to cancel any visual indication of a refresh. If an activity wishes to show just the progress animation, it should call setRefreshing(true). To disable the gesture and progress animation, call setEnabled(false) on the view.

This layout should be made the parent of the view that will be refreshed as a result of the gesture and can only support one direct child. This view will also be made the target of the gesture and will be forced to match both the width and the height supplied in this layout. The SwipeRefreshLayout does not provide accessibility events; instead, a menu item must be provided to allow refresh of the content wherever this gesture is used.

Summary

Nested types

Classes that wish to override canChildScrollUp method behavior should implement this interface.

Classes that wish to be notified when the swipe gesture correctly triggers a refresh should implement this interface.

Constants

const Int
const Int
const Int
LARGE = 0

Public constructors

Simple constructor to use when creating a SwipeRefreshLayout from code.

Constructor that is called when inflating SwipeRefreshLayout from XML.

Public functions

Boolean
Boolean
dispatchNestedFling(velocityX: Float, velocityY: Float, consumed: Boolean)
Boolean
dispatchNestedPreFling(velocityX: Float, velocityY: Float)
Boolean
dispatchNestedPreScroll(
    dx: Int,
    dy: Int,
    consumed: IntArray!,
    offsetInWindow: IntArray!
)
Boolean
dispatchNestedPreScroll(
    dx: Int,
    dy: Int,
    consumed: IntArray!,
    offsetInWindow: IntArray!,
    type: Int
)

Dispatch one step of a nested scroll in progress before this view consumes any portion of it.

Boolean
dispatchNestedScroll(
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    offsetInWindow: IntArray!
)
Boolean
dispatchNestedScroll(
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    offsetInWindow: IntArray!,
    type: Int
)

Dispatch one step of a nested scroll in progress.

Unit
dispatchNestedScroll(
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    offsetInWindow: IntArray?,
    type: Int,
    consumed: IntArray
)

Dispatch one step of a nested scroll in progress.

Int
Int

Get the diameter of the progress circle that is displayed as part of the swipe to refresh layout.

Int
Int
Boolean
Boolean

Returns true if this view has a nested scrolling parent for the given input type.

Boolean
Boolean
Boolean
Unit
onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int)
Boolean
onNestedFling(
    target: View!,
    velocityX: Float,
    velocityY: Float,
    consumed: Boolean
)
Boolean
onNestedPreFling(target: View!, velocityX: Float, velocityY: Float)
Unit
onNestedPreScroll(target: View!, dx: Int, dy: Int, consumed: IntArray!)
Unit
onNestedPreScroll(
    target: View!,
    dx: Int,
    dy: Int,
    consumed: IntArray!,
    type: Int
)

React to a nested scroll in progress before the target view consumes a portion of the scroll.

Unit
onNestedScroll(
    target: View!,
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int
)
Unit
onNestedScroll(
    target: View!,
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    type: Int
)

React to a nested scroll in progress.

Unit
onNestedScroll(
    target: View,
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    type: Int,
    consumed: IntArray
)

React to a nested scroll in progress.

Unit
onNestedScrollAccepted(child: View!, target: View!, axes: Int)
Unit
onNestedScrollAccepted(child: View!, target: View!, axes: Int, type: Int)

React to the successful claiming of a nested scroll operation.

Boolean
onStartNestedScroll(child: View!, target: View!, nestedScrollAxes: Int)
Boolean
onStartNestedScroll(child: View!, target: View!, axes: Int, type: Int)

React to a descendant view initiating a nestable scroll operation, claiming the nested scroll operation if appropriate.

Unit
Unit
onStopNestedScroll(target: View!, type: Int)

React to a nested scroll operation ending.

Boolean
Unit
Unit

This function is deprecated.

Use setColorSchemeResources

Unit

Set the colors used in the progress animation.

Unit

Set the color resources used in the progress animation from color resources.

Unit

Set the distance to trigger a sync in dips

Unit
setEnabled(enabled: Boolean)
Unit

This function is deprecated.

Only use this method if the changes introduced in requestDisallowInterceptTouchEvent in version 1.1.0-alpha03 and 1.1.1 are breaking your application.

Unit
Unit

Set a callback to override canChildScrollUp method.

Unit

Set the listener to be notified when a refresh is triggered via the swipe gesture.

Unit

This function is deprecated.

Use setProgressBackgroundColorSchemeResource

Unit

Set the background color of the progress spinner disc.

Unit

Set the background color of the progress spinner disc.

Unit

The refresh indicator resting position is always positioned near the top of the refreshing content.

Unit
setProgressViewOffset(scale: Boolean, start: Int, end: Int)

The refresh indicator starting and resting position is always positioned near the top of the refreshing content.

Unit
setRefreshing(refreshing: Boolean)

Notify the widget that refresh state has changed.

Unit
setSize(size: Int)

One of DEFAULT, or LARGE.

Unit
setSlingshotDistance(slingshotDistance: @Px Int)

Sets the distance that the refresh indicator can be pulled beyond its resting position during a swipe gesture.

Boolean
Boolean
startNestedScroll(axes: Int, type: Int)

Begin a nestable scroll operation along the given axes, for the given input type.

Unit
Unit

Stop a nested scroll in progress for the given input type.

Protected functions

Int
getChildDrawingOrder(childCount: Int, i: Int)
Unit
Unit
onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int)
Unit
Parcelable!

Protected properties

Int
Int

Inherited Constants

From android.view.View
const Int
const Int
const Int
const Int
const Int
const Int
const Property<View!, Float!>!
const Int
const String!
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE = "creditCardExpirationDate"
const String!
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY = "creditCardExpirationDay"
const String!
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH = "creditCardExpirationMonth"
const String!
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR = "creditCardExpirationYear"
const String!
const String!
AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE = "creditCardSecurityCode"
const String!
const String!
const String!
const String!
const String!
const String!
const String!
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const Int
const Int
const Int
const Int
const Int
const Int
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const Int
const Int
const Int
const Int
const Int
const Int
const Int
GONE = 8
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
KEEP_SCREEN_ON = 67108864
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
NO_ID = -1
const Int
const Int
const Int
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const Property<View!, Float!>!
const Property<View!, Float!>!
const Property<View!, Float!>!
const Property<View!, Float!>!
const Property<View!, Float!>!
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const IntArray<Int>!
const IntArray<Int>!
const Int
const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Property<View!, Float!>!
const Property<View!, Float!>!
const Property<View!, Float!>!
const String!
VIEW_LOG_TAG = "View"
const Int
const IntArray<Int>!
const Property<View!, Float!>!
const Property<View!, Float!>!
const Property<View!, Float!>!
From android.view.ViewGroup
const Int
const Int
const Int
const Int
const Int
const Int
const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

Inherited functions

From android.view.View
Unit
Unit
Unit
ViewPropertyAnimator!
Unit
Unit
Boolean
Unit
Unit

This function is deprecated.

Unit
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Unit
Unit
Unit
Boolean
Unit
Unit
java-static Int
combineMeasuredStates(curState: Int, newState: Int)
Int
Int
Int
Unit
WindowInsets!
computeSystemWindowInsets(in: WindowInsets!, outLocalInsets: Rect!)
Int
Int
Int
AccessibilityNodeInfo!
Unit
Unit

This function is deprecated.

Boolean
Boolean
dispatchNestedPrePerformAccessibilityAction(
    action: Int,
    arguments: Bundle!
)
Boolean
Unit
draw(canvas: Canvas!)
Unit
OnBackInvokedDispatcher!
T!
<T : View?> findViewById(id: Int)
T!
<T : View?> findViewWithTag(tag: Any!)
Boolean

This function is deprecated.

Unit
forceHasOverlappingRendering(hasOverlappingRendering: Boolean)
Unit
Unit
generateDisplayHash(
    hashAlgorithm: String!,
    bounds: Rect!,
    executor: Executor!,
    callback: DisplayHashResultCallback!
)
java-static Int
View.AccessibilityDelegate!
Int
AccessibilityNodeProvider!
CharSequence!
Int
Int
String!
String!
Float
Animation!
Matrix!
IBinder!
IntArray<Int>!
(Mutable)Map<Int!, Int!>!
Array<String!>!
AutofillId!
Int
AutofillValue!
Drawable!
BlendMode!
ColorStateList!
PorterDuff.Mode!
Int
Int
Float
Int
Float
Rect!
Boolean
getClipBounds(outRect: Rect!)
Boolean
ContentCaptureSession!
CharSequence!
Context!
ContextMenu.ContextMenuInfo!
Boolean
java-static Int
getDefaultSize(size: Int, measureSpec: Int)
Display!
IntArray<Int>!
Bitmap!

This function is deprecated.

Int

This function is deprecated.

Int

This function is deprecated.

Unit
getDrawingRect(outRect: Rect!)
Long
Float
Int
Boolean
Boolean
Int
ArrayList<View!>!
getFocusables(direction: Int)
Unit
Drawable!
Int
BlendMode!
ColorStateList!
PorterDuff.Mode!
Boolean
getGlobalVisibleRect(r: Rect!, globalOffset: Point!)
Handler!
Float
Float
Float
Float
Runnable!
Boolean
Int
Unit
getHitRect(outRect: Rect!)
Int
Int
Drawable!
Drawable!
Int
Int
Int
Int
Boolean
KeyEvent.DispatcherState!
Int
Int
Int
ViewGroup.LayoutParams!
Int
Float
Int
Boolean
Unit
Unit
Unit
Matrix!
Int
Int
Int
Int
Int
Int
Int
Int
Int
Int
Int
Int
Int
View.OnFocusChangeListener!
Int
ViewOutlineProvider!
Int
Int
ViewOverlay!
Int
Int
Int
Int
Int
Int
ViewParent!
ViewParent!
Float
Float
PointerIcon!
(Mutable)List<Rect!>!
Array<String!>!
Resources!
Boolean
Int
Float
Int
AttachedSurfaceControl!
View!
WindowInsets!
Float
Float
Float
Float
Float
Int
Int
Int
Int
Int
Int
Int
Int
Int
Int
CharSequence!
StateListAnimator!
Int
Int
(Mutable)List<Rect!>!
Int

This function is deprecated.

Any!
Int
Int
CharSequence!
Int
Float
Int
TouchDelegate!
ArrayList<View!>!
Float
String!
Float
Float
Float
Long
Int
Int
Drawable!
Drawable!
Int
ViewTranslationResponse!
ViewTreeObserver!
Int
Int
Int
WindowId!
WindowInsetsController!
Int

This function is deprecated.

IBinder!
Int
Unit
Float
Float
Float
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
java-static View!
inflate(context: Context!, resource: Int, root: ViewGroup!)
Unit
invalidate(dirty: Rect!)

This function is deprecated.

Unit
Unit
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean

This function is deprecated.

Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
View!
keyboardNavigationClusterSearch(currentCluster: View!, direction: Int)
Unit
measure(widthMeasureSpec: Int, heightMeasureSpec: Int)
java-static IntArray<Int>!
mergeDrawableStates(baseState: IntArray!, additionalState: IntArray!)
Unit
Unit
Unit
Unit
WindowInsets!
Unit
Boolean
Boolean
Unit
Unit
InputConnection!
Unit
onCreateViewTranslationRequest(
    supportedFormats: IntArray!,
    requestsCollector: Consumer<ViewTranslationRequest!>!
)
Unit
onCreateVirtualViewTranslationRequests(
    virtualIds: LongArray!,
    supportedFormats: IntArray!,
    requestsCollector: Consumer<ViewTranslationRequest!>!
)
Unit
Boolean
Unit
onDraw(canvas: Canvas!)
Unit
Unit
Boolean
Unit
Unit
Unit
onFocusChanged(
    gainFocus: Boolean,
    direction: Int,
    previouslyFocusedRect: Rect!
)
Boolean
Unit
Boolean
Unit
Unit
Boolean
onKeyDown(keyCode: Int, event: KeyEvent!)
Boolean
onKeyLongPress(keyCode: Int, event: KeyEvent!)
Boolean
onKeyMultiple(keyCode: Int, repeatCount: Int, event: KeyEvent!)
Boolean
onKeyPreIme(keyCode: Int, event: KeyEvent!)
Boolean
onKeyShortcut(keyCode: Int, event: KeyEvent!)
Boolean
onKeyUp(keyCode: Int, event: KeyEvent!)
Unit
onOverScrolled(
    scrollX: Int,
    scrollY: Int,
    clampedX: Boolean,
    clampedY: Boolean
)
Unit
Unit
Unit
Unit
Unit
Unit
Unit
ContentInfo!
Unit
onRtlPropertiesChanged(layoutDirection: Int)
Unit
onScreenStateChanged(screenState: Int)
Unit
onScrollCaptureSearch(
    localVisibleRect: Rect!,
    windowOffset: Point!,
    targets: Consumer<ScrollCaptureTarget!>!
)
Unit
onScrollChanged(l: Int, t: Int, oldl: Int, oldt: Int)
Boolean
onSetAlpha(alpha: Int)
Unit
onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int)
Unit
Boolean
Unit
Unit
Unit
Unit
onVisibilityChanged(changedView: View!, visibility: Int)
Unit
onWindowFocusChanged(hasWindowFocus: Boolean)
Unit

This function is deprecated.

Unit
Boolean
overScrollBy(
    deltaX: Int,
    deltaY: Int,
    scrollX: Int,
    scrollY: Int,
    scrollRangeX: Int,
    scrollRangeY: Int,
    maxOverScrollX: Int,
    maxOverScrollY: Int,
    isTouchEvent: Boolean
)
Boolean
performAccessibilityAction(action: Int, arguments: Bundle!)
Boolean
Boolean
Boolean
performHapticFeedback(feedbackConstant: Int)
Boolean
ContentInfo!
Unit
playSoundEffect(soundConstant: Int)
Boolean
post(action: Runnable!)
Boolean
postDelayed(action: Runnable!, delayMillis: Long)
Unit
Unit
postInvalidateDelayed(delayMilliseconds: Long)
Unit
Unit
Unit
postOnAnimationDelayed(action: Runnable!, delayMillis: Long)
Unit
Unit
Boolean
Unit
Unit
Unit
Unit
Unit

This function is deprecated.

Boolean
Unit
Unit
Boolean
Unit
T!
<T : View?> requireViewById(id: Int)
Unit
java-static Int
resolveSize(size: Int, measureSpec: Int)
java-static Int
resolveSizeAndState(size: Int, measureSpec: Int, childMeasuredState: Int)
Unit
Unit
saveAttributeDataForStyleable(
    context: Context!,
    styleable: IntArray!,
    attrs: AttributeSet!,
    t: TypedArray!,
    defStyleAttr: Int,
    defStyleRes: Int
)
Unit
Unit
scheduleDrawable(who: Drawable!, what: Runnable!, when: Long)
Unit
scrollBy(x: Int, y: Int)
Unit
scrollTo(x: Int, y: Int)
Unit
Unit
Unit
setAccessibilityDataSensitive(accessibilityDataSensitive: Int)
Unit
Unit
Unit
Unit
setAccessibilityPaneTitle(accessibilityPaneTitle: CharSequence!)
Unit
Unit
Unit
setActivated(activated: Boolean)
Unit
setAllowClickWhenDisabled(clickableWhenDisabled: Boolean)
Unit
Unit
Unit
setAlpha(alpha: Float)
Unit
setAnimation(animation: Animation!)
Unit
Unit
Unit
setAutofillHints(autofillHints: Array<String!>!)
Unit
Unit
setBackground(background: Drawable!)
Unit
Unit

This function is deprecated.

Unit
Unit
Unit
Unit
Unit
setBottom(bottom: Int)
Unit
Unit
setClickable(clickable: Boolean)
Unit
setClipBounds(clipBounds: Rect!)
Unit
setClipToOutline(clipToOutline: Boolean)
Unit
Unit
setContentDescription(contentDescription: CharSequence!)
Unit
setContextClickable(contextClickable: Boolean)
Unit
setDefaultFocusHighlightEnabled(defaultFocusHighlightEnabled: Boolean)
Unit

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit
Unit
setElevation(elevation: Float)
Unit
Unit
Unit
setFitsSystemWindows(fitSystemWindows: Boolean)
Unit
setFocusable(focusable: Boolean)
Unit
setFocusableInTouchMode(focusableInTouchMode: Boolean)
Unit
setFocusedByDefault(isFocusedByDefault: Boolean)
Unit
Unit
setForeground(foreground: Drawable!)
Unit
Unit
Unit
Unit
Unit
setHandwritingBoundsOffsets(
    offsetLeft: Float,
    offsetTop: Float,
    offsetRight: Float,
    offsetBottom: Float
)
Unit
Unit
setHapticFeedbackEnabled(hapticFeedbackEnabled: Boolean)
Unit
setHasTransientState(hasTransientState: Boolean)
Unit
setHorizontalFadingEdgeEnabled(horizontalFadingEdgeEnabled: Boolean)
Unit
setHorizontalScrollBarEnabled(horizontalScrollBarEnabled: Boolean)
Unit
Unit
Unit
setHovered(hovered: Boolean)
Unit
setId(id: Int)
Unit
Unit
Unit
Unit
setIsCredential(isCredential: Boolean)
Unit
setIsHandwritingDelegate(isHandwritingDelegate: Boolean)
Unit
setKeepScreenOn(keepScreenOn: Boolean)
Unit
Unit
Unit
Unit
setLayerType(layerType: Int, paint: Paint!)
Unit
setLayoutDirection(layoutDirection: Int)
Unit
Unit
setLeft(left: Int)
Unit
setLeftTopRightBottom(left: Int, top: Int, right: Int, bottom: Int)
Unit
setLongClickable(longClickable: Boolean)
Unit
setMeasuredDimension(measuredWidth: Int, measuredHeight: Int)
Unit
setMinimumHeight(minHeight: Int)
Unit
setMinimumWidth(minWidth: Int)
Unit
setNextClusterForwardId(nextClusterForwardId: Int)
Unit
setNextFocusDownId(nextFocusDownId: Int)
Unit
setNextFocusForwardId(nextFocusForwardId: Int)
Unit
setNextFocusLeftId(nextFocusLeftId: Int)
Unit
setNextFocusRightId(nextFocusRightId: Int)
Unit
setNextFocusUpId(nextFocusUpId: Int)
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
setOnReceiveContentListener(
    mimeTypes: Array<String!>!,
    listener: OnReceiveContentListener!
)
Unit
Unit

This function is deprecated.

Unit
Unit
Unit
Unit
Unit
setOverScrollMode(overScrollMode: Int)
Unit
setPadding(left: Int, top: Int, right: Int, bottom: Int)
Unit
setPaddingRelative(start: Int, top: Int, end: Int, bottom: Int)
Unit
setPivotX(pivotX: Float)
Unit
setPivotY(pivotY: Float)
Unit
setPointerIcon(pointerIcon: PointerIcon!)
Unit
setPreferKeepClear(preferKeepClear: Boolean)
Unit
Unit
setPressed(pressed: Boolean)
Unit
setRenderEffect(renderEffect: RenderEffect!)
Unit
setRevealOnFocusHint(revealOnFocus: Boolean)
Unit
setRight(right: Int)
Unit
setRotation(rotation: Float)
Unit
setRotationX(rotationX: Float)
Unit
setRotationY(rotationY: Float)
Unit
Unit
Unit
setScaleX(scaleX: Float)
Unit
setScaleY(scaleY: Float)
Unit
setScreenReaderFocusable(screenReaderFocusable: Boolean)
Unit
setScrollBarDefaultDelayBeforeFade(
    scrollBarDefaultDelayBeforeFade: Int
)
Unit
setScrollBarFadeDuration(scrollBarFadeDuration: Int)
Unit
setScrollBarSize(scrollBarSize: Int)
Unit
Unit
Unit
Unit
setScrollContainer(isScrollContainer: Boolean)
Unit
setScrollIndicators(indicators: Int)
Unit
setScrollX(value: Int)
Unit
setScrollY(value: Int)
Unit
Unit
setSelected(selected: Boolean)
Unit
setSoundEffectsEnabled(soundEffectsEnabled: Boolean)
Unit
setStateDescription(stateDescription: CharSequence!)
Unit
Unit
Unit

This function is deprecated.

Unit
setTag(tag: Any!)
Unit
setTextAlignment(textAlignment: Int)
Unit
setTextDirection(textDirection: Int)
Unit
Unit
setTop(top: Int)
Unit
Unit
Unit
setTransitionName(transitionName: String!)
Unit
Unit
setTranslationX(translationX: Float)
Unit
setTranslationY(translationY: Float)
Unit
setTranslationZ(translationZ: Float)
Unit
setVerticalFadingEdgeEnabled(verticalFadingEdgeEnabled: Boolean)
Unit
setVerticalScrollBarEnabled(verticalScrollBarEnabled: Boolean)
Unit
Unit
Unit
Unit
Unit
setVisibility(visibility: Int)
Unit
setWillNotCacheDrawing(willNotCacheDrawing: Boolean)

This function is deprecated.

Unit
setWillNotDraw(willNotDraw: Boolean)
Unit
setX(x: Float)
Unit
setY(y: Float)
Unit
setZ(z: Float)
Boolean
ActionMode!
Unit
Boolean
startDrag(
    data: ClipData!,
    shadowBuilder: View.DragShadowBuilder!,
    myLocalState: Any!,
    flags: Int
)

This function is deprecated.

Boolean
startDragAndDrop(
    data: ClipData!,
    shadowBuilder: View.DragShadowBuilder!,
    myLocalState: Any!,
    flags: Int
)
String!
Unit
Unit
Unit
Unit
Boolean
Boolean

This function is deprecated.

Boolean
From android.view.ViewGroup
Unit
Unit
addExtraDataToAccessibilityNodeInfo(
    info: AccessibilityNodeInfo!,
    extraDataKey: String!,
    arguments: Bundle!
)
Unit
addFocusables(views: ArrayList<View!>!, direction: Int, focusableMode: Int)
Unit
addKeyboardNavigationClusters(
    views: (Mutable)Collection<View!>!,
    direction: Int
)
Boolean
Unit
Unit
addView(child: View!)
Boolean
addViewInLayout(child: View!, index: Int, params: ViewGroup.LayoutParams!)
Unit
attachLayoutAnimationParameters(
    child: View!,
    params: ViewGroup.LayoutParams!,
    index: Int,
    count: Int
)
Unit
attachViewToParent(child: View!, index: Int, params: ViewGroup.LayoutParams!)
Unit
Boolean
Boolean
Unit
Unit
childHasTransientStateChanged(
    child: View!,
    childHasTransientState: Boolean
)
Unit
Unit
Unit
Unit
Unit
debug(depth: Int)
Unit
Unit
Unit
detachViewsFromParent(start: Int, count: Int)
WindowInsets!
Boolean
Unit
Unit
dispatchCreateViewTranslationRequest(
    viewIds: (Mutable)Map<AutofillId!, LongArray!>!,
    supportedFormats: IntArray!,
    capability: TranslationCapability!,
    requests: (Mutable)List<ViewTranslationRequest!>!
)
Unit
Boolean
Unit
dispatchDraw(canvas: Canvas!)
Unit
Unit
Unit
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Unit
Unit
Unit
Unit
Unit
Unit
dispatchScrollCaptureSearch(
    localVisibleRect: Rect!,
    windowOffset: Point!,
    targets: Consumer<ScrollCaptureTarget!>!
)
Unit
Unit
Unit
Unit
Unit

This function is deprecated.

Unit
Boolean
Boolean
Boolean
dispatchUnhandledMove(focused: View!, direction: Int)
Unit
dispatchVisibilityChanged(changedView: View!, visibility: Int)
Unit
Unit
Unit
WindowInsets!
dispatchWindowInsetsAnimationProgress(
    insets: WindowInsets!,
    runningAnimations: (Mutable)List<WindowInsetsAnimation!>!
)
WindowInsetsAnimation.Bounds!
Unit

This function is deprecated.

Unit
Boolean
drawChild(canvas: Canvas!, child: View!, drawingTime: Long)
Unit
Unit
View!
OnBackInvokedDispatcher!
Unit
findViewsWithText(
    outViews: ArrayList<View!>!,
    text: CharSequence!,
    flags: Int
)
View!
focusSearch(focused: View!, direction: Int)
Unit
Boolean
ViewGroup.LayoutParams!
ViewGroup.LayoutParams!
CharSequence!
View!
getChildAt(index: Int)
Int
java-static Int
getChildMeasureSpec(spec: Int, padding: Int, childDimension: Int)
Boolean
Boolean
getChildVisibleRect(child: View!, r: Rect!, offset: Point!)
Boolean
Boolean
Int
View!
LayoutAnimationController!
Animation.AnimationListener!
Int
LayoutTransition!
ViewGroupOverlay!
Int

This function is deprecated.

Boolean
Boolean
Boolean
Int
indexOfChild(child: View!)
Unit
invalidateChild(child: View!, dirty: Rect!)

This function is deprecated.

ViewParent!
invalidateChildInParent(location: IntArray!, dirty: Rect!)

This function is deprecated.

Boolean

This function is deprecated.

Boolean

This function is deprecated.

Boolean
Boolean

This function is deprecated.

Boolean
Boolean
Boolean
Unit
Unit
layout(l: Int, t: Int, r: Int, b: Int)
Unit
measureChild(
    child: View!,
    parentWidthMeasureSpec: Int,
    parentHeightMeasureSpec: Int
)
Unit
measureChildWithMargins(
    child: View!,
    parentWidthMeasureSpec: Int,
    widthUsed: Int,
    parentHeightMeasureSpec: Int,
    heightUsed: Int
)
Unit
measureChildren(widthMeasureSpec: Int, heightMeasureSpec: Int)
Unit
notifySubtreeAccessibilityStateChanged(
    child: View!,
    source: View!,
    changeType: Int
)
Unit
offsetDescendantRectToMyCoords(descendant: View!, rect: Rect!)
Unit
offsetRectIntoDescendantCoords(descendant: View!, rect: Rect!)
Unit
IntArray<Int>!
Unit
onDescendantInvalidated(child: View!, target: View!)
Boolean
Boolean
onNestedPrePerformAccessibilityAction(
    target: View!,
    action: Int,
    args: Bundle!
)
Boolean
onRequestFocusInDescendants(direction: Int, previouslyFocusedRect: Rect!)
Boolean
PointerIcon!
onResolvePointerIcon(event: MotionEvent!, pointerIndex: Int)
Unit
onViewAdded(child: View!)
Unit
Unit
Unit
Unit
Unit
removeDetachedView(child: View!, animate: Boolean)
Unit
removeView(view: View!)
Unit
removeViewAt(index: Int)
Unit
Unit
removeViews(start: Int, count: Int)
Unit
removeViewsInLayout(start: Int, count: Int)
Unit
requestChildFocus(child: View!, focused: View!)
Boolean
requestChildRectangleOnScreen(
    child: View!,
    rectangle: Rect!,
    immediate: Boolean
)
Boolean
requestFocus(direction: Int, previouslyFocusedRect: Rect!)
Boolean
Unit
Boolean
Unit
Unit
Unit

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit
Unit

This function is deprecated.

Unit
setClipChildren(clipChildren: Boolean)
Unit
setClipToPadding(clipToPadding: Boolean)
Unit
Unit
Unit
Unit
setLayoutMode(layoutMode: Int)
Unit
Unit
Unit
Unit
setPersistentDrawingCache(drawingCacheToKeep: Int)

This function is deprecated.

Unit
Unit
setTouchscreenBlocksFocus(touchscreenBlocksFocus: Boolean)
Unit
setTransitionGroup(isTransitionGroup: Boolean)
Unit
Boolean
Boolean
showContextMenuForChild(originalView: View!)
ActionMode!
startActionModeForChild(
    originalView: View!,
    callback: ActionMode.Callback!
)
Unit
Unit
Unit
Unit

Constants

DEFAULT

Added in 1.0.0
const val DEFAULT = 1: Int

DEFAULT_SLINGSHOT_DISTANCE

Added in 1.0.0
const val DEFAULT_SLINGSHOT_DISTANCE = -1: Int

LARGE

Added in 1.0.0
const val LARGE = 0: Int

Public constructors

SwipeRefreshLayout

Added in 1.0.0
SwipeRefreshLayout(context: Context)

Simple constructor to use when creating a SwipeRefreshLayout from code.

Parameters
context: Context

SwipeRefreshLayout

Added in 1.0.0
SwipeRefreshLayout(context: Context, attrs: AttributeSet?)

Constructor that is called when inflating SwipeRefreshLayout from XML.

Parameters
context: Context
attrs: AttributeSet?

Public functions

canChildScrollUp

Added in 1.0.0
fun canChildScrollUp(): Boolean
Returns
Boolean

Whether it is possible for the child view of this layout to scroll up. Override this if the child view is a custom view.

dispatchNestedFling

fun dispatchNestedFling(velocityX: Float, velocityY: Float, consumed: Boolean): Boolean

dispatchNestedPreFling

fun dispatchNestedPreFling(velocityX: Float, velocityY: Float): Boolean

dispatchNestedPreScroll

fun dispatchNestedPreScroll(
    dx: Int,
    dy: Int,
    consumed: IntArray!,
    offsetInWindow: IntArray!
): Boolean

dispatchNestedPreScroll

Added in 1.1.0
fun dispatchNestedPreScroll(
    dx: Int,
    dy: Int,
    consumed: IntArray!,
    offsetInWindow: IntArray!,
    type: Int
): Boolean

Dispatch one step of a nested scroll in progress before this view consumes any portion of it.

Nested pre-scroll events are to nested scroll events what touch intercept is to touch. dispatchNestedPreScroll offers an opportunity for the parent view in a nested scrolling operation to consume some or all of the scroll operation before the child view consumes it.

Parameters
dx: Int

Horizontal scroll distance in pixels

dy: Int

Vertical scroll distance in pixels

consumed: IntArray!

Output. If not null, consumed[0] will contain the consumed component of dx and consumed[1] the consumed dy.

offsetInWindow: IntArray!

Optional. If not null, on return this will contain the offset in local view coordinates of this view from before this operation to after it completes. View implementations may use this to adjust expected input coordinate tracking.

type: Int

the type of input which cause this scroll event

Returns
Boolean

true if the parent consumed some or all of the scroll delta

dispatchNestedScroll

fun dispatchNestedScroll(
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    offsetInWindow: IntArray!
): Boolean

dispatchNestedScroll

Added in 1.1.0
fun dispatchNestedScroll(
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    offsetInWindow: IntArray!,
    type: Int
): Boolean

Dispatch one step of a nested scroll in progress.

Implementations of views that support nested scrolling should call this to report info about a scroll in progress to the current nested scrolling parent. If a nested scroll is not currently in progress or nested scrolling is not enabled for this view this method does nothing.

Compatible View implementations should also call dispatchNestedPreScroll before consuming a component of the scroll event themselves.

Parameters
dxConsumed: Int

Horizontal distance in pixels consumed by this view during this scroll step

dyConsumed: Int

Vertical distance in pixels consumed by this view during this scroll step

dxUnconsumed: Int

Horizontal scroll distance in pixels not consumed by this view

dyUnconsumed: Int

Horizontal scroll distance in pixels not consumed by this view

offsetInWindow: IntArray!

Optional. If not null, on return this will contain the offset in local view coordinates of this view from before this operation to after it completes. View implementations may use this to adjust expected input coordinate tracking.

type: Int

the type of input which cause this scroll event

Returns
Boolean

true if the event was dispatched, false if it could not be dispatched.

dispatchNestedScroll

Added in 1.1.0
fun dispatchNestedScroll(
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    offsetInWindow: IntArray?,
    type: Int,
    consumed: IntArray
): Unit

Dispatch one step of a nested scroll in progress.

Implementations of views that support nested scrolling should call this to report info about a scroll in progress to the current nested scrolling parent. If a nested scroll is not currently in progress or nested scrolling is not enabled for this view this method does nothing.

Compatible View implementations should also call dispatchNestedPreScroll before consuming a component of the scroll event themselves.

The original nested scrolling child (where the input events were received to start the scroll) must provide a non-null consumed parameter with values {0, 0}.

Parameters
dxConsumed: Int

Horizontal distance in pixels consumed by this view during this scroll step

dyConsumed: Int

Vertical distance in pixels consumed by this view during this scroll step

dxUnconsumed: Int

Horizontal scroll distance in pixels not consumed by this view

dyUnconsumed: Int

Horizontal scroll distance in pixels not consumed by this view

offsetInWindow: IntArray?

Optional. If not null, on return this will contain the offset in local view coordinates of this view from before this operation to after it completes. View implementations may use this to adjust expected input coordinate tracking.

type: Int

the type of input which cause this scroll event

consumed: IntArray

Output. Upon this method returning, will contain the original values plus any scroll distances consumed by all of this view's nested scrolling parents up the view hierarchy. Index 0 for the x dimension, and index 1 for the y dimension

See also
onNestedScroll

getNestedScrollAxes

fun getNestedScrollAxes(): Int

getProgressCircleDiameter

Added in 1.0.0
fun getProgressCircleDiameter(): Int

Get the diameter of the progress circle that is displayed as part of the swipe to refresh layout.

Returns
Int

Diameter in pixels of the progress circle view.

getProgressViewEndOffset

Added in 1.0.0
fun getProgressViewEndOffset(): Int
Returns
Int

The offset in pixels from the top of this view at which the progress spinner should come to rest after a successful swipe gesture.

getProgressViewStartOffset

Added in 1.0.0
fun getProgressViewStartOffset(): Int
Returns
Int

The offset in pixels from the top of this view at which the progress spinner should appear.

hasNestedScrollingParent

fun hasNestedScrollingParent(): Boolean

hasNestedScrollingParent

Added in 1.1.0
fun hasNestedScrollingParent(type: Int): Boolean

Returns true if this view has a nested scrolling parent for the given input type.

The presence of a nested scrolling parent indicates that this view has initiated a nested scroll and it was accepted by an ancestor view further up the view hierarchy.

Parameters
type: Int

the type of input which cause this scroll event

Returns
Boolean

whether this view has a nested scrolling parent

isNestedScrollingEnabled

fun isNestedScrollingEnabled(): Boolean

isRefreshing

Added in 1.0.0
fun isRefreshing(): Boolean
Returns
Boolean

Whether the SwipeRefreshWidget is actively showing refresh progress.

onInterceptTouchEvent

fun onInterceptTouchEvent(ev: MotionEvent!): Boolean

onMeasure

Added in 1.0.0
fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int): Unit

onNestedFling

fun onNestedFling(
    target: View!,
    velocityX: Float,
    velocityY: Float,
    consumed: Boolean
): Boolean

onNestedPreFling

fun onNestedPreFling(target: View!, velocityX: Float, velocityY: Float): Boolean

onNestedPreScroll

fun onNestedPreScroll(target: View!, dx: Int, dy: Int, consumed: IntArray!): Unit

onNestedPreScroll

Added in 1.1.0
fun onNestedPreScroll(
    target: View!,
    dx: Int,
    dy: Int,
    consumed: IntArray!,
    type: Int
): Unit

React to a nested scroll in progress before the target view consumes a portion of the scroll.

When working with nested scrolling often the parent view may want an opportunity to consume the scroll before the nested scrolling child does. An example of this is a drawer that contains a scrollable list. The user will want to be able to scroll the list fully into view before the list itself begins scrolling.

onNestedPreScroll is called when a nested scrolling child invokes dispatchNestedPreScroll. The implementation should report how any pixels of the scroll reported by dx, dy were consumed in the consumed array. Index 0 corresponds to dx and index 1 corresponds to dy. This parameter will never be null. Initial values for consumed[0] and consumed[1] will always be 0.

Parameters
target: View!

View that initiated the nested scroll

dx: Int

Horizontal scroll distance in pixels

dy: Int

Vertical scroll distance in pixels

consumed: IntArray!

Output. The horizontal and vertical scroll distance consumed by this parent

type: Int

the type of input which cause this scroll event

onNestedScroll

fun onNestedScroll(
    target: View!,
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int
): Unit

onNestedScroll

Added in 1.1.0
fun onNestedScroll(
    target: View!,
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    type: Int
): Unit

React to a nested scroll in progress.

This method will be called when the ViewParent's current nested scrolling child view dispatches a nested scroll event. To receive calls to this method the ViewParent must have previously returned true for a call to onStartNestedScroll.

Both the consumed and unconsumed portions of the scroll distance are reported to the ViewParent. An implementation may choose to use the consumed portion to match or chase scroll position of multiple child elements, for example. The unconsumed portion may be used to allow continuous dragging of multiple scrolling or draggable elements, such as scrolling a list within a vertical drawer where the drawer begins dragging once the edge of inner scrolling content is reached.

Parameters
target: View!

The descendent view controlling the nested scroll

dxConsumed: Int

Horizontal scroll distance in pixels already consumed by target

dyConsumed: Int

Vertical scroll distance in pixels already consumed by target

dxUnconsumed: Int

Horizontal scroll distance in pixels not consumed by target

dyUnconsumed: Int

Vertical scroll distance in pixels not consumed by target

type: Int

the type of input which cause this scroll event

onNestedScroll

Added in 1.1.0
fun onNestedScroll(
    target: View,
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    type: Int,
    consumed: IntArray
): Unit

React to a nested scroll in progress.

This method will be called when the ViewParent's current nested scrolling child view dispatches a nested scroll event. To receive calls to this method the ViewParent must have previously returned true for a call to onStartNestedScroll.

Both the consumed and unconsumed portions of the scroll distance are reported to the ViewParent. An implementation may choose to use the consumed portion to match or chase scroll position of multiple child elements, for example. The unconsumed portion may be used to allow continuous dragging of multiple scrolling or draggable elements, such as scrolling a list within a vertical drawer where the drawer begins dragging once the edge of inner scrolling content is reached.

This method is called when a nested scrolling child invokes dispatchNestedScroll} or one of methods it overloads.

An implementation must report how many pixels of the the x and y scroll distances were consumed by this nested scrolling parent by adding the consumed distances to the consumed parameter. If this View also implements NestedScrollingChild3, consumed should also be passed up to it's nested scrolling parent so that the parent may also add any scroll distance it consumes. Index 0 corresponds to dx and index 1 corresponds to dy.

Parameters
target: View

The descendant view controlling the nested scroll

dxConsumed: Int

Horizontal scroll distance in pixels already consumed by target

dyConsumed: Int

Vertical scroll distance in pixels already consumed by target

dxUnconsumed: Int

Horizontal scroll distance in pixels not consumed by target

dyUnconsumed: Int

Vertical scroll distance in pixels not consumed by target

type: Int

the type of input which cause this scroll event

consumed: IntArray

Output. Upon this method returning, will contain the scroll distances consumed by this nested scrolling parent and the scroll distances consumed by any other parent up the view hierarchy

onNestedScrollAccepted

fun onNestedScrollAccepted(child: View!, target: View!, axes: Int): Unit

onNestedScrollAccepted

Added in 1.1.0
fun onNestedScrollAccepted(child: View!, target: View!, axes: Int, type: Int): Unit

React to the successful claiming of a nested scroll operation.

This method will be called after onStartNestedScroll returns true. It offers an opportunity for the view and its superclasses to perform initial configuration for the nested scroll. Implementations of this method should always call their superclass's implementation of this method if one is present.

Parameters
child: View!

Direct child of this ViewParent containing target

target: View!

View that initiated the nested scroll

axes: Int

Flags consisting of SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_VERTICAL or both

type: Int

the type of input which cause this scroll event

onStartNestedScroll

fun onStartNestedScroll(child: View!, target: View!, nestedScrollAxes: Int): Boolean

onStartNestedScroll

Added in 1.1.0
fun onStartNestedScroll(child: View!, target: View!, axes: Int, type: Int): Boolean

React to a descendant view initiating a nestable scroll operation, claiming the nested scroll operation if appropriate.

This method will be called in response to a descendant view invoking startNestedScroll. Each parent up the view hierarchy will be given an opportunity to respond and claim the nested scrolling operation by returning true.

This method may be overridden by ViewParent implementations to indicate when the view is willing to support a nested scrolling operation that is about to begin. If it returns true, this ViewParent will become the target view's nested scrolling parent for the duration of the scroll operation in progress. When the nested scroll is finished this ViewParent will receive a call to onStopNestedScroll.

Parameters
child: View!

Direct child of this ViewParent containing target

target: View!

View that initiated the nested scroll

axes: Int

Flags consisting of SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_VERTICAL or both

type: Int

the type of input which cause this scroll event

Returns
Boolean

true if this ViewParent accepts the nested scroll operation

onStopNestedScroll

fun onStopNestedScroll(target: View!): Unit

onStopNestedScroll

Added in 1.1.0
fun onStopNestedScroll(target: View!, type: Int): Unit

React to a nested scroll operation ending.

Perform cleanup after a nested scrolling operation. This method will be called when a nested scroll stops, for example when a nested touch scroll ends with a ACTION_UP or ACTION_CANCEL event. Implementations of this method should always call their superclass's implementation of this method if one is present.

Parameters
target: View!

View that initiated the nested scroll

type: Int

the type of input which cause this scroll event

onTouchEvent

fun onTouchEvent(ev: MotionEvent!): Boolean

requestDisallowInterceptTouchEvent

fun requestDisallowInterceptTouchEvent(b: Boolean): Unit

setColorScheme

fun setColorScheme(colors: @ColorRes IntArray!): Unit

setColorSchemeColors

fun setColorSchemeColors(colors: @ColorInt IntArray!): Unit

Set the colors used in the progress animation. The first color will also be the color of the bar that grows in response to a user swipe gesture.

Parameters
colors: @ColorInt IntArray!

setColorSchemeResources

fun setColorSchemeResources(colorResIds: @ColorRes IntArray!): Unit

Set the color resources used in the progress animation from color resources. The first color will also be the color of the bar that grows in response to a user swipe gesture.

Parameters
colorResIds: @ColorRes IntArray!

setDistanceToTriggerSync

Added in 1.0.0
fun setDistanceToTriggerSync(distance: Int): Unit

Set the distance to trigger a sync in dips

Parameters
distance: Int

setEnabled

fun setEnabled(enabled: Boolean): Unit

setLegacyRequestDisallowInterceptTouchEventEnabled

Added in 1.1.0
Deprecated in 1.1.0
fun setLegacyRequestDisallowInterceptTouchEventEnabled(enabled: Boolean): Unit

Enables the legacy behavior of requestDisallowInterceptTouchEvent from before 1.1.0-alpha03, where the request is neither honored, nor propagated up to its parents, in either of the following two cases:

  • The child as an AbsListView and the runtime is API <21
  • The child has nested scrolling disabled
Use this method only if your application:
  • is upgrading SwipeRefreshLayout from <1.1.1 to >= 1.1.0-alpha03
  • has a SwipeRefreshLayout, or its parent, that no longer responds to touch events when it should
  • setting this method to true fixes that issue
Parameters
enabled: Boolean

true to enable the legacy behavior, false for default behavior

setNestedScrollingEnabled

fun setNestedScrollingEnabled(enabled: Boolean): Unit

setOnChildScrollUpCallback

Added in 1.0.0
fun setOnChildScrollUpCallback(
    callback: SwipeRefreshLayout.OnChildScrollUpCallback?
): Unit

Set a callback to override canChildScrollUp method. Non-null callback will return the value provided by the callback and ignore all internal logic.

Parameters
callback: SwipeRefreshLayout.OnChildScrollUpCallback?

Callback that should be called when canChildScrollUp() is called.

setOnRefreshListener

Added in 1.0.0
fun setOnRefreshListener(listener: SwipeRefreshLayout.OnRefreshListener?): Unit

Set the listener to be notified when a refresh is triggered via the swipe gesture.

setProgressBackgroundColor

Added in 1.0.0
Deprecated in 1.0.0
fun setProgressBackgroundColor(colorRes: Int): Unit

setProgressBackgroundColorSchemeColor

Added in 1.0.0
fun setProgressBackgroundColorSchemeColor(color: @ColorInt Int): Unit

Set the background color of the progress spinner disc.

Parameters
color: @ColorInt Int

setProgressBackgroundColorSchemeResource

Added in 1.0.0
fun setProgressBackgroundColorSchemeResource(colorRes: @ColorRes Int): Unit

Set the background color of the progress spinner disc.

Parameters
colorRes: @ColorRes Int

Resource id of the color.

setProgressViewEndTarget

Added in 1.0.0
fun setProgressViewEndTarget(scale: Boolean, end: Int): Unit

The refresh indicator resting position is always positioned near the top of the refreshing content. This position is a consistent location, but can be adjusted in either direction based on whether or not there is a toolbar or actionbar present.

Parameters
scale: Boolean

Set to true if there is no view at a higher z-order than where the progress spinner is set to appear. Setting it to true will cause indicator to be scaled up rather than clipped.

end: Int

The offset in pixels from the top of this view at which the progress spinner should come to rest after a successful swipe gesture.

setProgressViewOffset

Added in 1.0.0
fun setProgressViewOffset(scale: Boolean, start: Int, end: Int): Unit

The refresh indicator starting and resting position is always positioned near the top of the refreshing content. This position is a consistent location, but can be adjusted in either direction based on whether or not there is a toolbar or actionbar present.

Note: Calling this will reset the position of the refresh indicator to start.

Parameters
scale: Boolean

Set to true if there is no view at a higher z-order than where the progress spinner is set to appear. Setting it to true will cause indicator to be scaled up rather than clipped.

start: Int

The offset in pixels from the top of this view at which the progress spinner should appear.

end: Int

The offset in pixels from the top of this view at which the progress spinner should come to rest after a successful swipe gesture.

setRefreshing

Added in 1.0.0
fun setRefreshing(refreshing: Boolean): Unit

Notify the widget that refresh state has changed. Do not call this when refresh is triggered by a swipe gesture.

Parameters
refreshing: Boolean

Whether or not the view should show refresh progress.

setSize

Added in 1.0.0
fun setSize(size: Int): Unit

One of DEFAULT, or LARGE.

setSlingshotDistance

Added in 1.0.0
fun setSlingshotDistance(slingshotDistance: @Px Int): Unit

Sets the distance that the refresh indicator can be pulled beyond its resting position during a swipe gesture. The default is DEFAULT_SLINGSHOT_DISTANCE.

Parameters
slingshotDistance: @Px Int

The distance in pixels that the refresh indicator can be pulled beyond its resting position.

startNestedScroll

fun startNestedScroll(axes: Int): Boolean

startNestedScroll

Added in 1.1.0
fun startNestedScroll(axes: Int, type: Int): Boolean

Begin a nestable scroll operation along the given axes, for the given input type.

A view starting a nested scroll promises to abide by the following contract:

The view will call startNestedScroll upon initiating a scroll operation. In the case of a touch scroll type this corresponds to the initial ACTION_DOWN. In the case of touch scrolling the nested scroll will be terminated automatically in the same manner as requestDisallowInterceptTouchEvent. In the event of programmatic scrolling the caller must explicitly call stopNestedScroll to indicate the end of the nested scroll.

If startNestedScroll returns true, a cooperative parent was found. If it returns false the caller may ignore the rest of this contract until the next scroll. Calling startNestedScroll while a nested scroll is already in progress will return true.

At each incremental step of the scroll the caller should invoke dispatchNestedPreScroll once it has calculated the requested scrolling delta. If it returns true the nested scrolling parent at least partially consumed the scroll and the caller should adjust the amount it scrolls by.

After applying the remainder of the scroll delta the caller should invoke dispatchNestedScroll, passing both the delta consumed and the delta unconsumed. A nested scrolling parent may treat these values differently. See onNestedScroll.

Parameters
axes: Int

Flags consisting of a combination of SCROLL_AXIS_HORIZONTAL and/or SCROLL_AXIS_VERTICAL.

type: Int

the type of input which cause this scroll event

Returns
Boolean

true if a cooperative parent was found and nested scrolling has been enabled for the current gesture.

stopNestedScroll

fun stopNestedScroll(): Unit

stopNestedScroll

Added in 1.1.0
fun stopNestedScroll(type: Int): Unit

Stop a nested scroll in progress for the given input type.

Calling this method when a nested scroll is not currently in progress is harmless.

Parameters
type: Int

the type of input which cause this scroll event

Protected functions

getChildDrawingOrder

protected fun getChildDrawingOrder(childCount: Int, i: Int): Int

onDetachedFromWindow

protected fun onDetachedFromWindow(): Unit

onLayout

protected fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int): Unit

onRestoreInstanceState

protected fun onRestoreInstanceState(state: Parcelable!): Unit

onSaveInstanceState

protected fun onSaveInstanceState(): Parcelable!

Protected properties

mFrom

Added in 1.0.0
protected val mFromInt

mOriginalOffsetTop

Added in 1.0.0
protected val mOriginalOffsetTopInt