diff --git a/vector/src/main/java/de/spiritcroc/recyclerview/StickyHeaderItemDecoration.kt b/vector/src/main/java/de/spiritcroc/recyclerview/StickyHeaderItemDecoration.kt index 4d7e66dbb4..32963a7541 100644 --- a/vector/src/main/java/de/spiritcroc/recyclerview/StickyHeaderItemDecoration.kt +++ b/vector/src/main/java/de/spiritcroc/recyclerview/StickyHeaderItemDecoration.kt @@ -52,6 +52,10 @@ abstract class StickyHeaderItemDecoration( if (parent.childCount == 0) { return } + if (!parent.canScrollVertically(1) && !parent.canScrollVertically(-1)) { + // No floating header needs if we cannot scroll, i.e. all headers are already visible + return + } val topChild = if (reverse) { parent.getChildAt(parent.childCount - 1) ?: return } else {