Disable floating headers when we cannot scroll
If recyclerView content is smaller then the recyclerView, we can already see all headers. Change-Id: I1b3b1506236701b75777d97a6fe759b2296f5db0
This commit is contained in:
parent
13b4fd9c33
commit
696c9c002f
@ -52,6 +52,10 @@ abstract class StickyHeaderItemDecoration(
|
|||||||
if (parent.childCount == 0) {
|
if (parent.childCount == 0) {
|
||||||
return
|
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) {
|
val topChild = if (reverse) {
|
||||||
parent.getChildAt(parent.childCount - 1) ?: return
|
parent.getChildAt(parent.childCount - 1) ?: return
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user