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

Fix tooltip issue in RTL layout #143

Open BahaaIddinSharqawi opened 4 years ago

BahaaIddinSharqawi commented 4 years ago

Hi,

Thank you for this great library, but when I try to show tooltip in "right to left" layout such as in Arabic language then the tooltip is shown in wrong place in screen!

How I can solve this problem?

This is my code to show tooltip:

 private void showToolTip() {
        if (mTooltip != null) mTooltip.dismiss();
        Tooltip.Gravity gravity = Tooltip.Gravity.TOP;
        ClosePolicy closePolicy = new ClosePolicy.Builder().consume(true).inside(true).outside(true).build();
        Tooltip.Animation animation = new Tooltip.Animation(8, 0, 400L);
        int showDuration = 3000;
        boolean arrow = true;
        boolean overlay = true;
        int style = R.style.ToolTipLayoutCustomStyle;
        String text = getString(R.string.tooltip_msg);
        View anchor = findViewById(R.id.btn);
        Tooltip.Builder tb = new Tooltip.Builder(this)
                .anchor(anchor, 0, 0, false)
                .text(text)
                .styleId(style)
                .arrow(arrow)
                .floatingAnimation(animation)
                .closePolicy(closePolicy)
                .showDuration(showDuration)
                .overlay(overlay);
        mTooltip = tb.create();
        mTooltip.show(anchor, gravity, false);
    }

Thank you...

Ebraheemb commented 4 years ago

+1

tahaelsherif commented 4 years ago

+1

hanuszewskiTMG commented 3 years ago

+1

SIARAY commented 2 years ago

I made changes to the library and apparently the problem has been fixed https://github.com/SIARAY/android-target-tooltip