-
-
Notifications
You must be signed in to change notification settings - Fork 285
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
Width of the balloon with a custom layout not adjusted properly when setting text dynamically #191
Comments
That is the expected result because the width size of the balloon will be decided on initializing the balloon. |
Thanks for the answer. So we have a real case where we need to set the text dynamically, which is not known during the balloon's initialization process (it is done much earlier than displaying the content). So is there any known solution for recalculating the width of the balloon, after modifying its content? |
We're also facing this issue. Would it be possible to enable recalculating the width of the balloon? For example, by making the |
I will consider processing the changes internally. 🤔 val label = customTagBalloon.getContentView().findViewById<TextView>(R.id.label)
label.text = "111111111111111111111344555"
val width = label.paint.measureText(label.text.toString())
label.maxWidth = width.toInt() |
I am also facing this issue, I have 3,4 textviews inside custom layout and the contents I get from backend API, and there is also a relay of 4,5 of this type of pop up for coach mark purpose, but the pop does not correctly meausre height and width of the inflated layout. |
Hi, @kaustav07.
|
Hi @skydoves , thanks for replying so quickly it still doesn't calculate the height properly... uploading layout file as well. below is my code -
Now when I use And when I use a fixed maxheight using |
I found out that if I use constraintLayout it doesn't calculate the view height properly even when initializing the balloon but with linearlayout it works fine. |
I found out that if you are using |
Thanks to everyone! The above information was very helpful for troubleshooting. |
Refactor measuring text sizes (#191)
Released a new stable |
@skydoves, please help me, when I upgraded to version 1.3.6, I still faced with this issue, many thanks. |
me too , but release-1.2.9 the version is okay. |
@skydoves Faced this issue with ConstraintLayout and 0dp, version 1.4.1. Wrap constraint doesn't work correctly. |
Please complete the following information:
Describe the Bug:
We are using
Balloon.Factory()
with a custom layout resource that includes several textViews. After setting text values dynamically, the width of the balloon is not resized to wrap its content (it is fixed with the initial value). As a result, the height of the content increases. The solution provided in #91 cannot be used anymore, since methodmeasureTextWidth
is private now.The issue can be easily reproduced using the demo application:
Step 1 - Add id to the TextView in the
layout_custom_tag.xml
:Step 2 - change the text of that tagTextView to a different value, i.e.:
Step 3 - launch the application and click on the bottomNavBar. As a result, the height of the balloon increased, instead of the width. However, it works properly on version 1.3.0 of the library. Modified demo app to reproduce the issue is also available at: https://github.com/wkubaty/Balloon/tree/custom-layout-size-issue
Unexpected behavior on version 1.3.4:
Expected Behavior:
The width of the balloon with a custom layout should be adjusted properly when setting content dynamically.
Proper behavior on version 1.3.0:
The text was updated successfully, but these errors were encountered: