epoxy-adapter / com.airbnb.epoxy.stickyheader / StickyHeaderLinearLayoutManager

StickyHeaderLinearLayoutManager

class StickyHeaderLinearLayoutManager : LinearLayoutManager

Adds sticky headers capabilities to your RecyclerView.Adapter. The adapter / controller must override StickyHeaderCallbacks.isStickyHeader to indicate which items are sticky.

Example usage:

class StickyHeaderController() : EpoxyController() {
    override fun isStickyHeader(position: Int) {
        // Write your logic to tell which item is sticky.
    }
}

Types

SavedState

data class SavedState : Parcelable

Save / restore existing RecyclerView state and scrolling position and offset.

Constructors

<init>

StickyHeaderLinearLayoutManager(context: Context, orientation: Int = RecyclerView.VERTICAL, reverseLayout: Boolean = false)

Adds sticky headers capabilities to your RecyclerView.Adapter. The adapter / controller must override StickyHeaderCallbacks.isStickyHeader to indicate which items are sticky.

Functions

computeHorizontalScrollExtent

fun computeHorizontalScrollExtent(state: State): Int

computeHorizontalScrollOffset

fun computeHorizontalScrollOffset(state: State): Int

computeHorizontalScrollRange

fun computeHorizontalScrollRange(state: State): Int

computeScrollVectorForPosition

fun computeScrollVectorForPosition(targetPosition: Int): PointF?

computeVerticalScrollExtent

fun computeVerticalScrollExtent(state: State): Int

computeVerticalScrollOffset

fun computeVerticalScrollOffset(state: State): Int

computeVerticalScrollRange

fun computeVerticalScrollRange(state: State): Int

isStickyHeader

fun isStickyHeader(view: View): Boolean

Returns true if view is the current sticky header.

onAdapterChanged

fun onAdapterChanged(oldAdapter: Adapter<*>?, newAdapter: Adapter<*>?): Unit

onAttachedToWindow

fun onAttachedToWindow(recyclerView: RecyclerView): Unit

onFocusSearchFailed

fun onFocusSearchFailed(focused: View, focusDirection: Int, recycler: Recycler, state: State): View?

onLayoutChildren

fun onLayoutChildren(recycler: Recycler, state: State): Unit

onRestoreInstanceState

fun onRestoreInstanceState(state: Parcelable?): Unit

onSaveInstanceState

fun onSaveInstanceState(): Parcelable

scrollHorizontallyBy

fun scrollHorizontallyBy(dx: Int, recycler: Recycler, state: State?): Int

scrollToPosition

fun scrollToPosition(position: Int): Unit

scrollToPositionWithOffset

fun scrollToPositionWithOffset(position: Int, offset: Int): Unit

scrollVerticallyBy

fun scrollVerticallyBy(dy: Int, recycler: Recycler, state: State?): Int

setStickyHeaderTranslationX

fun setStickyHeaderTranslationX(translationX: Float): Unit

Offsets the horizontal location of the sticky header relative to the its default position.

setStickyHeaderTranslationY

fun setStickyHeaderTranslationY(translationY: Float): Unit

Offsets the vertical location of the sticky header relative to the its default position.