skydoves / Balloon

:balloon: Modernized and sophisticated tooltips, fully customizable with an arrow and animations for Android.
https://skydoves.github.io/libraries/balloon/html/balloon/com.skydoves.balloon/index.html
Apache License 2.0
3.69k stars 289 forks source link

Text/images cut off on sides #42

Closed gavingt closed 4 years ago

gavingt commented 4 years ago

If the width of the Balloon is close to the width of the content inside it, the content gets cut off on the left and right sides.

I've tried playing with various builder methods to fix this, and nothing does.

Screenshot_1587902594

skydoves commented 4 years ago

Hi, @gavingt could you let me know about your device information?

gavingt commented 4 years ago

It's happening on all devices. The above screenshot is from a Nexus S API 28 emulator.

Here's my physical Pixel 3 on API 29:

Screenshot_20200426-061555

And here's another emulator (Nexus 5X API 26):

Screenshot_1587907158

All I'm doing is changing the text string in the sample app. Once it reaches a certain length, the text and icon get cut off.

skydoves commented 4 years ago

Hmm. I built using Nexus 5X API 26, Gallaxy s7/10 but it works fine. I will check its details more.

screenshot389987803

gavingt commented 4 years ago

If the text is long enough, it will wrap around to the next line and nothing will be cut off. But if it's just the right length, it will get cut off.

In other words, if the string just barely fits in one line, it'll be cut off.

NikoBoerger commented 4 years ago

Just ran into the same issue. Glad someone reported it already. Will it come in version 1.1.7? Thank you!

skydoves commented 4 years ago

Hi, this issue will be resolved in the next version. Thank you :)

skydoves commented 4 years ago

Hi, @gavingt , @NikoBoerger It is fixed on the new version 1.1.7. Thank you for your issue :)

NikoBoerger commented 4 years ago

Hi @skydoves, thank you so much for the fix. It works great on most of my devices. However, on my Samsung Tablet I still experience the Icon being cut at the left side, and the text being cut on the right side with the version 1.1.7. Exactly like on the initial screenshot from gavingt.

This is my setting:

public static Balloon.Builder createBalloonBuilder(View view, Activity activity) {
        return new Balloon.Builder(activity)
                .setArrowSize((int) toDp(R.dimen._10sdp, activity))
                .setArrowOrientation(ArrowOrientation.TOP)
                .setArrowVisible(true)
                .setArrowPosition(calculateArrowPosition(view, activity))
                .setWidthRatio(1.0f)
                .setPaddingTop((int) toDp(R.dimen._10sdp, activity))
                .setPaddingBottom((int) toDp(R.dimen._10sdp, activity))
                .setTextSize(toDp(R.dimen._12sdp, activity))
                .setCornerRadius(toDp(R.dimen._4sdp, activity))
                .setAlpha(0.95f)
                .setIconSize((int) toDp(R.dimen._20sdp, activity))
                .setPaddingLeft((int) toDp(R.dimen._10sdp, activity))
                .setPaddingRight((int) toDp(R.dimen._10sdp, activity))
                .setTextColor(ContextCompat.getColor(activity, R.color.colorPrimaryDark))
                .setBackgroundColor(ContextCompat.getColor(activity, R.color.colorPrimary100))
                .setBalloonAnimation(BalloonAnimation.FADE)
                .setDismissWhenTouchOutside(true)
                .setDismissWhenClicked(true);
    } 

Screenshot_20200517-173838_Dart Pro Training Sheet

skydoves commented 4 years ago

Hi, @NikoBoerger I just re-published the 1.1.7 version. Please run below command and rebuild your project.

./gradlew build --refresh-dependencies
gavingt commented 4 years ago

This seems solved to me. I'm not getting text or icons cut off on any of my devices. Thank you so much!