SlidingPaneLayout


class SlidingPaneLayout : ViewGroup, Openable


SlidingPaneLayout provides a horizontal, multi-pane layout for use at the top level of a UI. A left (or start) pane is treated as a content list or browser, subordinate to a primary detail view for displaying content.

Child views overlap if their combined width exceeds the available width in the SlidingPaneLayout. Each of child views is expand out to fill the available width in the SlidingPaneLayout. When this occurs, the user may slide the topmost view out of the way by dragging it, and dragging back it from the very edge.

Thanks to this sliding behavior, SlidingPaneLayout may be suitable for creating layouts that can smoothly adapt across many different screen sizes, expanding out fully on larger screens and collapsing on smaller screens.

SlidingPaneLayout is distinct from a navigation drawer as described in the design guide and should not be used in the same scenarios. SlidingPaneLayout should be thought of only as a way to allow a two-pane layout normally used on larger screens to adapt to smaller screens in a natural way. The interaction patterns expressed by SlidingPaneLayout imply a physicality and direct information hierarchy between panes that does not necessarily exist in a scenario where a navigation drawer should be used instead.

Appropriate uses of SlidingPaneLayout include pairings of panes such as a contact list and subordinate interactions with those contacts, or an email thread list with the content pane displaying the contents of the selected thread. Inappropriate uses of SlidingPaneLayout include switching between disparate functions of your app, such as jumping from a social stream view to a view of your personal profile - cases such as this should use the navigation drawer pattern instead. (DrawerLayout implements this pattern.)

Like LinearLayout, SlidingPaneLayout supports the use of the layout parameter layout_weight on child views to determine how to divide leftover space after measurement is complete. It is only relevant for width. When views do not overlap weight behaves as it does in a LinearLayout.

Summary

Constants

const Int

The user cannot swipe between list and detail panes, though the app can open or close the detail pane programmatically.

const Int

The detail pane is locked in a closed position.

const Int

The detail pane is locked in an open position.

const Int

User can freely swipe between list and detail panes.

Public constructors

SlidingPaneLayout(context: Context, attrs: AttributeSet?)
SlidingPaneLayout(context: Context, attrs: AttributeSet?, defStyle: Int)

Public functions

Unit

Adds the specified listener to the list of listeners that will be notified of panel slide events.

Unit
addView(child: View, index: Int, params: ViewGroup.LayoutParams?)
Boolean

This function is deprecated.

Renamed to isSlideable - this method is going away soon!

Unit

Close the detail view if it is currently slideable.

Boolean

Close the detail view if it is currently slideable.

Unit
Unit
draw(c: Canvas!)
ViewGroup.LayoutParams!
@ColorInt Int

This function is deprecated.

This field is no longer populated by SlidingPaneLayout

Int

Get the lock mode used to control over the swipe behavior.

@Px Int
@ColorInt Int

This function is deprecated.

This field is no longer populated by SlidingPaneLayout.

Boolean

Check if the detail view is completely open.

Boolean

Check if both the list and detail view panes in this layout can fully fit side-by-side.

Boolean
Boolean
Unit

Open the detail view if it is currently slideable.

Boolean

Open the detail view if it is currently slideable.

Unit

Removes the specified listener from the list of listeners that will be notified of panel slide events.

Unit
Unit
requestChildFocus(child: View!, focused: View!)
Unit

This function is deprecated.

SlidingPaneLayout no longer uses this field.

Unit
setLockMode(lockMode: Int)

Set the lock mode that controls how the user can swipe between the panes.

Unit

This function is deprecated.

Use addPanelSlideListener

Unit
setParallaxDistance(parallaxBy: @Px Int)

Set a distance to parallax the lower pane by when the upper pane is in its fully closed state.

Unit

This function is deprecated.

Renamed to setShadowDrawableLeft to support LTR (left to right language) and setShadowDrawableRight to support RTL (right to left language) during opening/closing.

Unit

Set a drawable to use as a shadow cast by the right pane onto the left pane during opening/closing.

Unit

Set a drawable to use as a shadow cast by the left pane onto the right pane during opening/closing to support right to left language.

Unit

This function is deprecated.

Renamed to setShadowResourceLeft to support LTR (left to right language) and setShadowResourceRight to support RTL (right to left language) during opening/closing.

Unit

Set a drawable to use as a shadow cast by the right pane onto the left pane during opening/closing.

Unit

Set a drawable to use as a shadow cast by the left pane onto the right pane during opening/closing to support right to left language.

Unit

This function is deprecated.

SlidingPaneLayout no longer uses this field.

Unit

This function is deprecated.

Renamed to closePane - this method is going away soon!

Unit

This function is deprecated.

Renamed to openPane - this method is going away soon!

Protected functions

Boolean
canScroll(v: View!, checkV: Boolean, dx: Int, x: Int, y: Int)

Tests scrollability within child views of v given a delta of dx.

Boolean
Boolean
drawChild(canvas: Canvas!, child: View!, drawingTime: Long)
ViewGroup.LayoutParams!
ViewGroup.LayoutParams!
Unit
Unit
Unit
onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int)
Unit
onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int)
Unit
Parcelable!
Unit
onSizeChanged(w: Int, h: Int, oldw: Int, oldh: 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
WindowInsets!
computeSystemWindowInsets(in: WindowInsets!, outLocalInsets: Rect!)
Int
Int
Int
AccessibilityNodeInfo!
Unit
Unit

This function is deprecated.

Boolean
Boolean
dispatchNestedFling(velocityX: Float, velocityY: Float, consumed: Boolean)
Boolean
dispatchNestedPreFling(velocityX: Float, velocityY: Float)
Boolean
dispatchNestedPrePerformAccessibilityAction(
    action: Int,
    arguments: Bundle!
)
Boolean
dispatchNestedPreScroll(
    dx: Int,
    dy: Int,
    consumed: IntArray!,
    offsetInWindow: IntArray!
)
Boolean
dispatchNestedScroll(
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    offsetInWindow: IntArray!
)
Boolean
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
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
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
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
setEnabled(enabled: Boolean)
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
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
)
Boolean
Unit
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
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
Unit
Unit
View!
OnBackInvokedDispatcher!
Unit
findViewsWithText(
    outViews: ArrayList<View!>!,
    text: CharSequence!,
    flags: Int
)
View!
focusSearch(focused: View!, direction: Int)
Unit
Boolean
CharSequence!
View!
getChildAt(index: Int)
Int
Int
getChildDrawingOrder(childCount: Int, drawingPosition: 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!
Int
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!)
IntArray<Int>!
Unit
onDescendantInvalidated(child: View!, target: View!)
Boolean
Boolean
onNestedFling(
    target: View!,
    velocityX: Float,
    velocityY: Float,
    consumed: Boolean
)
Boolean
onNestedPreFling(target: View!, velocityX: Float, velocityY: Float)
Boolean
onNestedPrePerformAccessibilityAction(
    target: View!,
    action: Int,
    args: Bundle!
)
Unit
onNestedPreScroll(target: View!, dx: Int, dy: Int, consumed: IntArray!)
Unit
onNestedScroll(
    target: View!,
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int
)
Unit
onNestedScrollAccepted(child: View!, target: View!, axes: Int)
Boolean
onRequestFocusInDescendants(direction: Int, previouslyFocusedRect: Rect!)
Boolean
PointerIcon!
onResolvePointerIcon(event: MotionEvent!, pointerIndex: Int)
Boolean
onStartNestedScroll(child: View!, target: View!, nestedScrollAxes: Int)
Unit
Unit
onViewAdded(child: View!)
Unit
Unit
Unit
Unit
Unit
removeDetachedView(child: View!, animate: Boolean)
Unit
removeViewAt(index: Int)
Unit
Unit
removeViews(start: Int, count: Int)
Unit
removeViewsInLayout(start: Int, count: Int)
Boolean
requestChildRectangleOnScreen(
    child: View!,
    rectangle: Rect!,
    immediate: Boolean
)
Unit
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

LOCK_MODE_LOCKED

Added in 1.2.0
const val LOCK_MODE_LOCKED = 3: Int

The user cannot swipe between list and detail panes, though the app can open or close the detail pane programmatically.

LOCK_MODE_LOCKED_CLOSED

Added in 1.2.0
const val LOCK_MODE_LOCKED_CLOSED = 2: Int

The detail pane is locked in a closed position. The user cannot swipe to open the detail pane, but the app can open the detail pane programmatically.

LOCK_MODE_LOCKED_OPEN

Added in 1.2.0
const val LOCK_MODE_LOCKED_OPEN = 1: Int

The detail pane is locked in an open position. The user cannot swipe to close the detail pane, but the app can close the detail pane programmatically.

LOCK_MODE_UNLOCKED

Added in 1.2.0
const val LOCK_MODE_UNLOCKED = 0: Int

User can freely swipe between list and detail panes.

Public constructors

SlidingPaneLayout

Added in 1.1.0
SlidingPaneLayout(context: Context)

SlidingPaneLayout

Added in 1.1.0
SlidingPaneLayout(context: Context, attrs: AttributeSet?)

SlidingPaneLayout

Added in 1.1.0
SlidingPaneLayout(context: Context, attrs: AttributeSet?, defStyle: Int)

Public functions

addPanelSlideListener

Added in 1.2.0
fun addPanelSlideListener(listener: SlidingPaneLayout.PanelSlideListener): Unit

Adds the specified listener to the list of listeners that will be notified of panel slide events.

Parameters
listener: SlidingPaneLayout.PanelSlideListener

Listener to notify when panel slide events occur.

addView

fun addView(child: View, index: Int, params: ViewGroup.LayoutParams?): Unit

canSlide

Added in 1.1.0
Deprecated in 1.1.0
fun canSlide(): Boolean
Returns
Boolean

true if content in this layout can be slid open and closed

close

Added in 1.1.0
fun close(): Unit

Close the detail view if it is currently slideable. If first layout has already completed this will animate.

closePane

Added in 1.1.0
fun closePane(): Boolean

Close the detail view if it is currently slideable. If first layout has already completed this will animate.

Returns
Boolean

true if the pane was slideable and is now closed/in the process of closing

computeScroll

fun computeScroll(): Unit

draw

fun draw(c: Canvas!): Unit

generateLayoutParams

fun generateLayoutParams(attrs: AttributeSet!): ViewGroup.LayoutParams!

getCoveredFadeColor

Added in 1.1.0
Deprecated in 1.2.0
fun getCoveredFadeColor(): @ColorInt Int
Returns
@ColorInt Int

The ARGB-packed color value used to fade the fixed pane

getLockMode

Added in 1.2.0
fun getLockMode(): Int

Get the lock mode used to control over the swipe behavior.

See also
setLockMode

getParallaxDistance

Added in 1.1.0
fun getParallaxDistance(): @Px Int
Returns
@Px Int

The distance the lower pane will parallax by when the upper pane is fully closed.

getSliderFadeColor

Added in 1.1.0
Deprecated in 1.2.0
fun getSliderFadeColor(): @ColorInt Int
Returns
@ColorInt Int

The ARGB-packed color value used to fade the sliding pane

isOpen

Added in 1.1.0
fun isOpen(): Boolean

Check if the detail view is completely open. It can be open either because the slider itself is open revealing the detail view, or if all content fits without sliding.

Returns
Boolean

true if the detail view is completely open

isSlideable

Added in 1.1.0
fun isSlideable(): Boolean

Check if both the list and detail view panes in this layout can fully fit side-by-side. If not, the content pane has the capability to slide back and forth. Note that the lock mode is not taken into account in this method. This method is typically used to determine whether the layout is showing two-pane or single-pane.

Returns
Boolean

true if both panes cannot fit side-by-side, and detail pane in this layout has the capability to slide back and forth.

onInterceptTouchEvent

fun onInterceptTouchEvent(ev: MotionEvent!): Boolean

onTouchEvent

fun onTouchEvent(ev: MotionEvent!): Boolean

open

Added in 1.1.0
fun open(): Unit

Open the detail view if it is currently slideable. If first layout has already completed this will animate.

openPane

Added in 1.1.0
fun openPane(): Boolean

Open the detail view if it is currently slideable. If first layout has already completed this will animate.

Returns
Boolean

true if the pane was slideable and is now open/in the process of opening

removePanelSlideListener

Added in 1.2.0
fun removePanelSlideListener(
    listener: SlidingPaneLayout.PanelSlideListener
): Unit

Removes the specified listener from the list of listeners that will be notified of panel slide events.

Parameters
listener: SlidingPaneLayout.PanelSlideListener

Listener to remove from being notified of panel slide events

removeView

fun removeView(view: View): Unit

requestChildFocus

fun requestChildFocus(child: View!, focused: View!): Unit

setCoveredFadeColor

Added in 1.1.0
Deprecated in 1.2.0
fun setCoveredFadeColor(color: @ColorInt Int): Unit

Set the color used to fade the pane covered by the sliding pane out when the pane will become fully covered in the closed state.

Parameters
color: @ColorInt Int

An ARGB-packed color value

setLockMode

Added in 1.2.0
fun setLockMode(lockMode: Int): Unit

Set the lock mode that controls how the user can swipe between the panes.

Parameters
lockMode: Int

The new lock mode for the detail pane.

setPanelSlideListener

Added in 1.1.0
Deprecated in 1.2.0
fun setPanelSlideListener(listener: SlidingPaneLayout.PanelSlideListener?): Unit

Set a listener to be notified of panel slide events. Note that this method is deprecated and you should use addPanelSlideListener to add a listener and removePanelSlideListener to remove a registered listener.

Parameters
listener: SlidingPaneLayout.PanelSlideListener?

Listener to notify when drawer events occur

setParallaxDistance

Added in 1.1.0
fun setParallaxDistance(parallaxBy: @Px Int): Unit

Set a distance to parallax the lower pane by when the upper pane is in its fully closed state. The lower pane will scroll between this position and its fully open state.

Parameters
parallaxBy: @Px Int

Distance to parallax by in pixels

setShadowDrawable

Added in 1.1.0
Deprecated in 1.1.0
fun setShadowDrawable(d: Drawable!): Unit
Parameters
d: Drawable!

drawable to use as a shadow

setShadowDrawableLeft

Added in 1.1.0
fun setShadowDrawableLeft(d: Drawable?): Unit

Set a drawable to use as a shadow cast by the right pane onto the left pane during opening/closing.

Parameters
d: Drawable?

drawable to use as a shadow

setShadowDrawableRight

Added in 1.1.0
fun setShadowDrawableRight(d: Drawable?): Unit

Set a drawable to use as a shadow cast by the left pane onto the right pane during opening/closing to support right to left language.

Parameters
d: Drawable?

drawable to use as a shadow

setShadowResource

Added in 1.1.0
Deprecated in 1.1.0
fun setShadowResource(resId: @DrawableRes Int): Unit

Set a drawable to use as a shadow cast by the right pane onto the left pane during opening/closing.

Parameters
resId: @DrawableRes Int

Resource ID of a drawable to use

setShadowResourceLeft

Added in 1.1.0
fun setShadowResourceLeft(resId: Int): Unit

Set a drawable to use as a shadow cast by the right pane onto the left pane during opening/closing.

Parameters
resId: Int

Resource ID of a drawable to use

setShadowResourceRight

Added in 1.1.0
fun setShadowResourceRight(resId: Int): Unit

Set a drawable to use as a shadow cast by the left pane onto the right pane during opening/closing to support right to left language.

Parameters
resId: Int

Resource ID of a drawable to use

setSliderFadeColor

Added in 1.1.0
Deprecated in 1.2.0
fun setSliderFadeColor(color: @ColorInt Int): Unit

Set the color used to fade the sliding pane out when it is slid most of the way offscreen.

Parameters
color: @ColorInt Int

An ARGB-packed color value

smoothSlideClosed

Added in 1.1.0
Deprecated in 1.1.0
fun smoothSlideClosed(): Unit

smoothSlideOpen

Added in 1.1.0
Deprecated in 1.1.0
fun smoothSlideOpen(): Unit

Protected functions

canScroll

Added in 1.1.0
protected fun canScroll(v: View!, checkV: Boolean, dx: Int, x: Int, y: Int): Boolean

Tests scrollability within child views of v given a delta of dx.

Parameters
v: View!

View to test for horizontal scrollability

checkV: Boolean

Whether the view v passed should itself be checked for scrollability (true), or just its children (false).

dx: Int

Delta scrolled in pixels

x: Int

X coordinate of the active touch point

y: Int

Y coordinate of the active touch point

Returns
Boolean

true if child views of v can be scrolled by delta of dx.

checkLayoutParams

protected fun checkLayoutParams(p: ViewGroup.LayoutParams!): Boolean

drawChild

protected fun drawChild(canvas: Canvas!, child: View!, drawingTime: Long): Boolean

generateDefaultLayoutParams

protected fun generateDefaultLayoutParams(): ViewGroup.LayoutParams!

generateLayoutParams

protected fun generateLayoutParams(p: ViewGroup.LayoutParams!): ViewGroup.LayoutParams!

onAttachedToWindow

protected fun onAttachedToWindow(): Unit

onDetachedFromWindow

protected fun onDetachedFromWindow(): Unit

onLayout

protected fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int): Unit

onMeasure

protected fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int): Unit

onRestoreInstanceState

protected fun onRestoreInstanceState(state: Parcelable!): Unit

onSaveInstanceState

protected fun onSaveInstanceState(): Parcelable!

onSizeChanged

protected fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int): Unit