douglasjunior / android-simple-tooltip

A simple library based on PopupWindow to create Tooltips on Android. 💚

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Display tooltip when pressing on the button

jt4000 opened this issue · comments

Goal:
When you press the button, the tooltip shall display.

Problem:
What syntax code do I need to add?

Thank you!

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        View yourView = findViewById(R.id.btn_data);

        new SimpleTooltip.Builder(this)
                .anchorView(yourView)
                .text("Texto do Tooltip")
                .gravity(Gravity.END)
                .modal(true)
                .dismissOnOutsideTouch(true)
                .dismissOnInsideTouch(false)
                .showArrow(true)
                .build()
                .show();
    }
}

Please, take a look at the Sample Project. All examples are made with a button click.