Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Add ability to setup "hide on touch outside" #16

Closed
Ekalips opened this issue Aug 16, 2017 · 1 comment
Closed

Add ability to setup "hide on touch outside" #16

Ekalips opened this issue Aug 16, 2017 · 1 comment

Comments

@Ekalips
Copy link

Ekalips commented Aug 16, 2017

Please, add ability to hide not on tip click, but on click outside.

@vipulshah2010
Copy link

Use following workaround till native support is not added in library.

  1. Declare private View mTooltipView; in activity
  2. Implement onDisplay and onHide from ViewTooltip
.onDisplay(tooltipView -> mTooltipView = tooltipView)
                   .onHide(tooltipView -> mTooltipView = null)

3)override dispatchTouchEvent in activity.

@Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        if (mTooltipView != null) {
            ViewGroup parent = (ViewGroup) mTooltipView.getParent();
            if (parent != null) {
                parent.removeView(mTooltipView);
                mTooltipView = null;
            }
            return true;
        }
        return super.dispatchTouchEvent(ev);
    }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants