Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update custom view width calculation for TextViews #686

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading