Skip to content

jzeferino/Xamarin.Android.Tooltips

Repository files navigation

Build Status NuGet

Xamarin.Android.Tooltips

This is a Xamarin Android Binding for the tooltips.

This project provides you a convenient way and simple to use library for android, enabling to add a tooltip near any view with ease.

Usage

Step 1

Install NuGet package.

Step 2

Create a ToolTipsManager.

_toolTipsManager = new ToolTipsManager(this);

Step 3

Use the ToolTip.Builder to create and position your Tooltip.

builder = new ToolTip.Builder(
    this,
    _textView,              /* anchor view */
    _rootLayout,            /* root view of entire layout, must be a RelativeLayout or FrameLayout. */
    text,                   /* tooltip text */
    ToolTip.PositionAbove); /* Position related to achor view */

builder.SetAlign(_align);   /* arrow align */

_toolTipsManager.Show(builder.Build());

IMPORTANT NOTE:

If you want to how the tooltip immediately when the Activity is created you should Build and show the tooltip in the OnWindowsFocusChanged method, example:

public override void OnWindowFocusChanged(bool hasFocus)
{
    base.OnWindowFocusChanged(hasFocus);
    builder = new ToolTip.Builder(
        this,
        _textView,              /* anchor view */
        _rootLayout,            /* root view of entire layout, must be a RelativeLayout or FrameLayout. */
        text,                   /* tooltip text */
        ToolTip.PositionAbove); /* Position related to achor view */

    builder.SetAlign(_align);   /* arrow align */

    _toolTipsManager.Show(builder.Build());
}

In alternative you could use View.Post or View.PostDelayed in OnCreate.

Sample

Run and play with the sample.

More documentation

Read more detailed documention original library project.

License

MIT Licence

About

Xamarin.Android binding of android tooltips, a simple to use library for android, enabling to add a tooltip near any view with ease

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published