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

Tooltips inside when recycler view cell goes out of viewport #26

Closed ivnsch closed 4 years ago

ivnsch commented 4 years ago

Please complete the following information:

When I open a tooltip inside a recycler view cell and scroll such that the cell goes outside the view port, the tooltip stays inside (at the edge). This looks weird as it's not pointing to anything anymore.

Is it possible to make it go out of the screen together with the cell (and back in)?

Settings

setArrowSize(10)
//        setWidthRatio(1.0f)
setHeight(65)
setPadding(0)
//        setDismissWhenTouchOutside(true)
setPaddingLeft(10)
setPaddingRight(10)
//        setArrowPosition(.5f)
setSpace(10)
setCornerRadius(10f)
setAlpha(1f)
setTextColorResource(R.color.white)
setBackgroundColorResource(R.color.colorAccent)
setOnBalloonClickListener {
    onClick?.invoke()
}
setBalloonAnimation(BalloonAnimation.ELASTIC)
setLifecycleOwner(lifecycleOwner)

Note that setDismissWhenTouchOutside is commented. I don't want the tooltips to disappear immediately.

Screen Shot 2020-03-24 at 16 05 16

The tooltip showing in the screenshot belongs to an item that's outside (top) of the screen.

skydoves commented 4 years ago

It seems related to this issue from the usage of popupwindow. I will check out it soon usage in the RecyclerView.

ivnsch commented 4 years ago

Hi @skydoves thanks for your quick replies. I just wanted to ask if you think all the issues can be realistically fixed soon? Or do you have maybe any indicators for me to try to fix? We have a bit of time pressure.

skydoves commented 4 years ago

Hi, I've been thinking about this for some days, but there is no way to resolve this problem. The concept of the window is an abstract base class for a top-level window look and behavior policy. So the window is never subordinated by views. You can use the balloon instead of the ContextMenu. More lightweight and fully customizable with animation. So the best case is, use with the setDismissWhenTouchOutside or call dismiss manually when the recyclerView is scrolled. Anyway, thank you for your issue :)

ivnsch commented 4 years ago

Makes sense.