From aee43328f2b02eaf4e7fc49a95fb468c4501407d Mon Sep 17 00:00:00 2001 From: Chris Banes Date: Wed, 30 Nov 2016 04:07:27 +0000 Subject: [PATCH] Merge "Fix for AppBarLayout\'s scrolling view not laying out WIP" into nyc-dev am: 95c069158d * commit '95c069158d8fa777c4f930dad27c2a6ac59ec741': Fix for AppBarLayout's scrolling view not laying out WIP Change-Id: I42c75bc97bf73e2c1047f7d834a2431dfda5c905 GitOrigin-RevId=2400816160739eb13b55a91f790df19d8a267d10 PiperOrigin-RevId: 140561031 --- .../widget/HeaderScrollingViewBehavior.java | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/src/android/support/design/widget/HeaderScrollingViewBehavior.java b/src/android/support/design/widget/HeaderScrollingViewBehavior.java index f9c0f585e..129521a16 100644 --- a/src/android/support/design/widget/HeaderScrollingViewBehavior.java +++ b/src/android/support/design/widget/HeaderScrollingViewBehavior.java @@ -72,26 +72,24 @@ abstract class HeaderScrollingViewBehavior extends ViewOffsetBehavior { } } - if (ViewCompat.isLaidOut(header)) { - int availableHeight = View.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 - header.getMeasuredHeight() - + getScrollRange(header); - final int heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(height, - childLpHeight == ViewGroup.LayoutParams.MATCH_PARENT - ? View.MeasureSpec.EXACTLY - : View.MeasureSpec.AT_MOST); - - // Now measure the scrolling view with the correct height - parent.onMeasureChild(child, parentWidthMeasureSpec, - widthUsed, heightMeasureSpec, heightUsed); - - return true; + int availableHeight = View.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 - header.getMeasuredHeight() + + getScrollRange(header); + final int heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(height, + childLpHeight == ViewGroup.LayoutParams.MATCH_PARENT + ? View.MeasureSpec.EXACTLY + : View.MeasureSpec.AT_MOST); + + // Now measure the scrolling view with the correct height + parent.onMeasureChild(child, parentWidthMeasureSpec, + widthUsed, heightMeasureSpec, heightUsed); + + return true; } } return false;