Skip to content

Commit

Permalink
Merge pull request #686 from CzarMatt/mmossman/balloon/custom_layout_…
Browse files Browse the repository at this point in the history
…width_bug

Update custom view width calculation for TextViews
  • Loading branch information
skydoves committed Aug 20, 2024
2 parents e8619e2 + 8dd0def commit c459890
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions balloon/src/main/kotlin/com/skydoves/balloon/Balloon.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1885,7 +1885,7 @@ public class Balloon private constructor(
}

/**
* Measures the width of a [TextView] and set the measured with.
* Measures the width of a [TextView], including horizontal padding, and sets the measured width.
* If the width of the parent XML layout is the `WRAP_CONTENT`, and the width of [TextView]
* in the parent layout is `WRAP_CONTENT`, this method will measure the size of the width exactly.
*
Expand All @@ -1897,12 +1897,12 @@ public class Balloon private constructor(
if (compoundDrawablesRelative.isExistHorizontalDrawable()) {
minHeight = compoundDrawablesRelative.getIntrinsicHeight()
measuredTextWidth +=
compoundDrawablesRelative.getSumOfIntrinsicWidth() + sumOfCompoundPadding
compoundDrawablesRelative.getSumOfIntrinsicWidth()
} else if (compoundDrawables.isExistHorizontalDrawable()) {
minHeight = compoundDrawables.getIntrinsicHeight()
measuredTextWidth += compoundDrawables.getSumOfIntrinsicWidth() + sumOfCompoundPadding
measuredTextWidth += compoundDrawables.getSumOfIntrinsicWidth()
}
maxWidth = getMeasuredTextWidth(measuredTextWidth, rootView)
maxWidth = getMeasuredTextWidth(measuredTextWidth + sumOfCompoundPadding, rootView)
}
}

Expand Down

0 comments on commit c459890

Please sign in to comment.