From 8dd0defc148b6de2ccaa56cd25db19aa0d301048 Mon Sep 17 00:00:00 2001 From: mmossman Date: Mon, 19 Aug 2024 13:39:45 -0700 Subject: [PATCH] Resolved missing horizontal padding when calculating overall text view width for custom layouts. --- balloon/src/main/kotlin/com/skydoves/balloon/Balloon.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/balloon/src/main/kotlin/com/skydoves/balloon/Balloon.kt b/balloon/src/main/kotlin/com/skydoves/balloon/Balloon.kt index 128e46e9..866ce0a9 100644 --- a/balloon/src/main/kotlin/com/skydoves/balloon/Balloon.kt +++ b/balloon/src/main/kotlin/com/skydoves/balloon/Balloon.kt @@ -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. * @@ -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) } }