mirror of
https://github.com/material-components/material-components-android.git
synced 2026-02-20 08:39:55 +08:00
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
This commit is contained in:
parent
bfe05a65b3
commit
aee43328f2
@ -72,26 +72,24 @@ abstract class HeaderScrollingViewBehavior extends ViewOffsetBehavior<View> {
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user