use of com.github.xizzhu.simpletooltip.ToolTipView in project simple-tool-tip by xizzhu.
the class MainActivity method showToolTipView.
private void showToolTipView(final View anchorView, int gravity, CharSequence text, int backgroundColor, long delay) {
if (anchorView.getTag() != null) {
((ToolTipView) anchorView.getTag()).remove();
anchorView.setTag(null);
return;
}
ToolTip toolTip = createToolTip(text, backgroundColor);
ToolTipView toolTipView = createToolTipView(toolTip, anchorView, gravity);
if (delay > 0L) {
toolTipView.showDelayed(delay);
} else {
toolTipView.show();
}
anchorView.setTag(toolTipView);
toolTipView.setOnToolTipClickedListener(new ToolTipView.OnToolTipClickedListener() {
@Override
public void onToolTipClicked(ToolTipView toolTipView) {
anchorView.setTag(null);
}
});
}
Aggregations