Balloon: Balloon does not adapt to the height of a custom View

Please complete the following information:

  • Library version: com.github.skydoves:balloon:1.2.7
  • Affected Device: Samsung Galaxy s9 with Android 9.0

Describe the Bug:

We have implemented Balloon with a custom layout. Although the height has specified, some of the text will be cut out if the user adjusts the system font-size.

Code: https://github.com/wikimedia/apps-android-wikipedia/blob/22b07cdefc8fd184601ae657a2b01dcefd31ed57/app/src/main/java/org/wikipedia/util/FeedbackUtil.java#L226-L234

Expected Behavior: The library adapts the height of the custom view automatically.

I have checked https://github.com/skydoves/Balloon/issues/112 but it does not work for me.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 23 (10 by maintainers)

Most upvoted comments

@cooltey @epool

Finally, released a new 1.3.3 stable version.

Thanks for helping to fix this issue! I hope your projects will be going well and I will more appreciate adding this library on the Librareis used or Open source license pages. πŸ‘

Hi, @cooltey. Ohh I’m sorry for this issue. πŸ™ I just found there are some wrong calculations for measuring the width size of the TextView. Could you build again using the below SNAPSHOT version?

1.3.3-SNAPSHOT

You may need to add this to your gradle file.

repositories {
   maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}

If this issue would be fixed, I will release the next stable version.

Thanks, @skydoves, the SNAPSHOT version looks pretty good to me! It fixes all the issues πŸ’― πŸ‘

Looking forward to seeing the latest release, and thanks again for your hard works!

@skydoves v1.3.3 fixed the issue on our side, thank you so much!!! πŸ™ŒπŸΌ

@cooltey @epool

Finally, released a new 1.3.3 stable version.

Thanks for helping to fix this issue! I hope your projects will be going well and I will more appreciate adding this library on the Librareis used or Open source license pages. πŸ‘

@skydoves Thanks and I will absolutely add it to the license page πŸ˜ƒ

Hi @skydoves, thanks for the new release.

Not sure if we did the configuration incorrectly or something else, the existing code for the plain text Balloon also has the issue that the text is being cut off on the right side, should we update the current configuration? https://github.com/wikimedia/apps-android-wikipedia/blob/62a4accee6823a888d0be49b86ffd709b2b8f9c1/app/src/main/java/org/wikipedia/util/FeedbackUtil.kt#L199-L215

Screenshot: Screenshot_20210219-150919_Wikipedia Dev

Hi, @epool. I just found the issue and I will check soon! And I just solved the issue using .setPadding(8) for right now.

Makes sense. Thanks for checking πŸ˜ƒ

Thanks for your details!

I just found the problem is Drawable on the TextView. It seems the measuring is not properly executed if TextView has a (left or right) drawable. So we can check the balloon’s height will be created correctly or not without using the app:drawableStartCompat="@drawable/ic_star_24".

And I just pushed a commit for testing the measuring is being correct. The solution is just creating an ImageView instead of using the drawable on the TextView.

If we want to use the drawableStartCompat on the TextView, it should be calculated using the height size of the drawable internally when the TextVIew has a single line. I will check out more details about this issue πŸ˜ƒ

Thanks!

Hi @skydoves, thanks for the quick fixes πŸ‘

But unfortunately, looks like the issue is still there, here are the screenshots in different font-sizes:

Screenshot_20210128-162526_Wikipedia Dev Screenshot_20210128-162509_Wikipedia Dev

You may notice that the right edge is cutting off and maybe that’s the cause of the issue.

Here is the PR I have created: https://github.com/wikimedia/apps-android-wikipedia/pull/1998