sephiroth74 / android-target-tooltip

Create Toast like tooltips, but targets can be specified, plus custom properties and features
MIT License
1.49k stars 278 forks source link

Does this work with ConstrainLayout? #140

Open hscissors opened 5 years ago

hscissors commented 5 years ago

I'm spiking this library right now and every time I built the tooltip and anchor it to a view in a constraint layout, the tooltip only appears in the top left corner of the screen.

code-mantis commented 4 years ago

It works everywhere, you just have to make sure the view (u are attaching the tooltip to) is already created and it's coordinates, height and width is calculated so the library can display the tooltip in the correct place.. simply put the ToolTip code in [view you are attaching to].post{}, like this:

img_category.post { Tooltip.Builder(img_category.context) .anchor(img_category,0,0 ,false) .text(resources.getString(R.string.lbl_change_img)) .arrow(true) .floatingAnimation(Tooltip.Animation.SLOW) .closePolicy(ClosePolicy.TOUCH_NONE) .overlay(false) .create() .doOnHidden { } .doOnFailure { } .doOnShown { } .show(img_category, Tooltip.Gravity.BOTTOM, false) }