From f9009de091087261f25ddcd065a657bf3d7adc8d Mon Sep 17 00:00:00 2001 From: Chris Banes Date: Wed, 30 Nov 2016 01:20:16 +0000 Subject: [PATCH] am 8e0b8093: am 551a28ad: am 39cfe79f: am a0e42834: Merge "Allow AppBarLayout to handle size changes" into lmp-mr1-ub-dev * commit '8e0b80934b91b5398cd0a652fcd6316a7b98b472': Allow AppBarLayout to handle size changes GitOrigin-RevId=d8bf9fa65716dd427e0ee2366802385185f23c4e PiperOrigin-RevId: 140548869 --- src/android/support/design/widget/AppBarLayout.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/android/support/design/widget/AppBarLayout.java b/src/android/support/design/widget/AppBarLayout.java index 3007bf814..8ccb35705 100644 --- a/src/android/support/design/widget/AppBarLayout.java +++ b/src/android/support/design/widget/AppBarLayout.java @@ -1024,7 +1024,12 @@ public class AppBarLayout extends LinearLayout { ViewCompat.setFitsSystemWindows(child, true); } - final int height = parent.getHeight() - appBar.getMeasuredHeight() + int availableHeight = MeasureSpec.getSize(parentHeightMeasureSpec); + if (availableHeight == 0) { + // If the measure spec doesn't specify a size, use the current height + availableHeight = parent.getHeight(); + } + final int height = availableHeight - appBar.getMeasuredHeight() + appBar.getTotalScrollRange(); final int heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST);