Skip to content

Commit 6f28838

Browse files
dsn5fthunterstich
authored andcommitted
[CollapsingToolbarLayout] Fixed multiline RTL collapsed title text position
PiperOrigin-RevId: 382073266
1 parent 3a76417 commit 6f28838

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/java/com/google/android/material/internal/CollapsingTextHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -767,8 +767,8 @@ public void draw(@NonNull Canvas canvas) {
767767
final int saveCount = canvas.save();
768768
// Compute where to draw textLayout for this frame
769769
if (textToDraw != null && drawTitle) {
770-
final float currentExpandedX =
771-
currentDrawX + textLayout.getLineLeft(0) - expandedFirstLineDrawX * 2;
770+
float firstLineX = maxLines > 1 ? textLayout.getLineStart(0) : textLayout.getLineLeft(0);
771+
final float currentExpandedX = currentDrawX + firstLineX - expandedFirstLineDrawX * 2;
772772

773773
textPaint.setTextSize(currentTextSize);
774774
float x = currentDrawX;

0 commit comments

Comments
 (0)