Balloon icon indicating copy to clipboard operation
Balloon copied to clipboard

"setBackgroundColorResource" not applied when app theme has a custom background tint

Open SamH2022 opened this issue 10 months ago • 0 comments

Hello,

First, let me express my gratitude and appreciation to your great work, Thank you very much!! On the app I'm working on , the main app theme is Theme.MaterialComponents.DayNight.Bridge The background tint is set as as black. <item name="android:backgroundTint">@color/black</item> That affects the balloon 's setBackgroundColorResource . No matter what I do, the color never changes and stays black. Any suggestions will be very much appreciated.

Thanks

Update: It worth mentioning that setBackgroundColorResource works just fine if I set it up in a fragment, but not in an activity. Here's the activity initialization of the balloon that fails to change background color:

Balloon balloon = new Balloon.Builder(this) .setWidthRatio(0.75f) .setHeight(BalloonSizeSpec.WRAP) .setText(getString(R.string.password_lenght_incorrect)) .setTextColorResource(R.color.white) .setTextSize(15.0f) .setArrowPositionRules(ArrowPositionRules.ALIGN_ANCHOR) .setArrowSize(10) .setArrowPosition(0.5f) .setPaddingTop(5) .setPaddingBottom(5) .setPaddingLeft(10) .setPaddingRight(10) .setCornerRadius(8f) .setBackgroundColorResource(R.color.red) .setBalloonAnimation(BalloonAnimation.OVERSHOOT) .setLifecycleOwner(this) .build(); balloon.showAlignTop(passwordEditText);

In fragment, it's exactly the same except the LifeCycleOwner in activity is : this. in frgament is : getViewLifecycleOwner()

Thanks

SamH2022 avatar Mar 28 '25 13:03 SamH2022