ViewTooltip icon indicating copy to clipboard operation
ViewTooltip copied to clipboard

Padding doesn't work

Open MohamedAkl1 opened this issue 5 years ago • 4 comments

When adding padding as a parameter it has no effect whatsoever on the tooltips, it's like i never put them.

MohamedAkl1 avatar Nov 02 '18 11:11 MohamedAkl1

Hey @MohamedAkl1 did you make any progress with this? I'm running into a similar issue. Thanks

cgathergood avatar May 30 '19 00:05 cgathergood

Hi @cgathergood, @MohamedAkl1 . I have the same problem, too.

However, you can set paddings earlier it will work.

here is my code

val tooltip = ViewTooltip.on(anchorView)
        .text(text)
        .textColor(ContextCompat.getColor(context, R.color.brown))
        .textSize(TypedValue.COMPLEX_UNIT_SP, 14f)
        .color(ContextCompat.getColor(context, R.color.white))
        .corner(tooltipRadius)
        .border(Color.black, 0f)
        .padding(tooltipPadding, tooltipPadding, tooltipPadding, tooltipPadding)
        .position(ViewTooltip.Position.RIGHT)
        .autoHide(false, 10000)
        .clickToHide(true)
        .setTextGravity(Gravity.CENTER)
        .distanceWithView(marginLeft.toInt())
        .withShadow(true)
        .animation(ViewTooltip.FadeTooltipAnimation(200))
        .onHide {
            hide()
        }

this.tooltip = tooltip

The size of this tooltip will change.

YuanLiou avatar May 30 '19 02:05 YuanLiou

@cgathergood it was long time ago i think that i used a custom layout for the tooltip to make it work as intended. you can try @YuanLiou 's solution it seems to be working on his end so maybe it will work i'm not sure.

MohamedAkl1 avatar May 30 '19 03:05 MohamedAkl1

Thanks @MohamedAkl1 @YuanLiou

Turns out setting the padding, earlier works as expected. Thanks for helping out!

cgathergood avatar May 30 '19 03:05 cgathergood