Skip to content

Commit

Permalink
[CollapsingToolbarLayout] Fix issues related to rotating multiline co…
Browse files Browse the repository at this point in the history
…llapsing toolbars

PiperOrigin-RevId: 636597914
  • Loading branch information
dsn5ft authored and afohrman committed May 24, 2024
1 parent 60a525a commit 2bc1a2f
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -599,13 +599,15 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
updateTextBounds(0, 0, getMeasuredWidth(), getMeasuredHeight(), /* forceRecalculate= */ true);

int lineCount = collapsingTextHelper.getExpandedLineCount();
if (lineCount > 1) {
if (lineCount > 1 && collapsingTextHelper.getExpansionFraction() == 0f) {
// Add extra height based on the amount of height beyond the first line of title text.
int expandedTextHeight = Math.round(collapsingTextHelper.getExpandedTextFullHeight());
extraMultilineHeight = expandedTextHeight * (lineCount - 1);
int newHeight = getMeasuredHeight() + extraMultilineHeight;
heightMeasureSpec = MeasureSpec.makeMeasureSpec(newHeight, MeasureSpec.EXACTLY);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
} else {
extraMultilineHeight = 0;
}
}

Expand Down

0 comments on commit 2bc1a2f

Please sign in to comment.