Skip to content

Commit

Permalink
[TopAppBar] Exclude gone views from scroll range calculation
Browse files Browse the repository at this point in the history
Resolves #2709

PiperOrigin-RevId: 454163860
  • Loading branch information
drchen authored and pekingme committed Jun 10, 2022
1 parent eb54d6a commit 687e735
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/java/com/google/android/material/appbar/AppBarLayout.java
Expand Up @@ -677,6 +677,10 @@ public final int getTotalScrollRange() {
int range = 0;
for (int i = 0, z = getChildCount(); i < z; i++) {
final View child = getChildAt(i);
if (child.getVisibility() == GONE) {
// Gone views should not be included in the scroll range calculation.
continue;
}
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
final int childHeight = child.getMeasuredHeight();
final int flags = lp.scrollFlags;
Expand Down

0 comments on commit 687e735

Please sign in to comment.