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.75k stars 291 forks source link

Set Arrow seems to not working #32

Closed pcharbonnier closed 4 years ago

pcharbonnier commented 4 years ago

Please complete the following information:

Describe the Bug:

I'm trying to add my custom arrow to the balloon but it only show the default one. I tried with both methods

setArrowDrawableResource setArrowDrawable

 val balloon = Balloon.Builder(this)
                .setLayout(R.layout.popup_qty)
                .setArrowSize(15)
                .setArrowOrientation(ArrowOrientation.TOP)
                .setArrowPosition(0.5f)
                .setCornerRadius(10f)
                .setArrowVisible(true)
                .setArrowDrawable(ContextCompat.getDrawable(this, R.drawable.ic_custom_arrow))
                .setBalloonAnimation(BalloonAnimation.OVERSHOOT)
                .setDismissWhenTouchOutside(true)
                .setLifecycleOwner(this)
                .build()

 balloon.showAlignBottom(view)

Expected Behavior:

Displaying my custom arrow

skydoves commented 4 years ago

@pcharbonnier Hi, could you test again with using the .setBackgroundColorResource(R.color.colorPrimary)?

pcharbonnier commented 4 years ago

hi @skydoves

val balloon = Balloon.Builder(activity!!)
                .setLayout(R.layout.popup_qty)
                .setArrowSize(15)
                .setArrowOrientation(ArrowOrientation.TOP)
                .setArrowPosition(0.5f)
                .setCornerRadius(10f)
                .setDismissWhenTouchOutside(true)
                .setArrowVisible(true)
                .setArrowDrawable(ContextCompat.getDrawable(activity!!, R.drawable.ic_arrow_gray))
                .setBackgroundColorResource(R.color.colorPrimary)                       .setBalloonAnimation(BalloonAnimation.OVERSHOOT)
                .setLifecycleOwner(activity)
                .build()

I have test with .setBackgroundColorResource(R.color.colorPrimary)

Doesn't work Except that my arrow have now the same color of as colorPrimary

skydoves commented 4 years ago

@pcharbonnier Hi, I released a new release 1.1.3. You can test in the demo codes, You can use setArrowDrawableResource with setArrowColor or setArrowColorResource.

.setArrowDrawableResource(R.drawable.ic_arrow_gray)
.setArrowColorResource(R.color.yellow)
pcharbonnier commented 4 years ago

AAAh Maybe I missed something but

 val balloon = Balloon.Builder(activity!!)
                .setLayout(R.layout.popup_qty)
                .setArrowOrientation(ArrowOrientation.TOP)
                .setCornerRadius(4f)
                .setDismissWhenTouchOutside(true)
                .setAlpha(0.9f)
                .isRtlSupport(isRtlLayout())
                .setBackgroundColorResource(R.color.transparent)
                .setArrowDrawable(ContextCompat.getDrawable(activity!!, R.drawable.ic_arrow_gray))
                .setBalloonAnimation(BalloonAnimation.OVERSHOOT)
                .setLifecycleOwner(activity)
                .build()

now I have my arrow drawable. I removed some line and it's working. Maybe setArrowDrawable where incompatible with some methods.

So, sorry, MY BAD, sorry for the issue that is not really an issue

skydoves commented 4 years ago

Ah that's okay. I'm glad your problem is solved. Thank you :)