How To Design Custom Tooltip in Android Tutorial

In this tutorial we are going to design custom popupWindow. It works as the popupWindow. It takes in the parameter are anchor view which will help you the pop up window to overlay on the same view. Suppose you want to hover the text on the button then you just have to give anchor view as onclick view of button.

In this tutorial we are going to design custom pop up window with the help of third party library. If you don’t wish to use this library then you can use popUpWindow class which is an in build android class.

So without a further ado let’s get started.

To start with we have to load the third party library. To add copy the below line in dependency.

Creating user interface

  • We have to create simple UI for this application. With just two buttons. Place the below code in activity_main.xml.

     
  • Two give a style to our pop up we have to add the following style code in style.xml.

     

Building the main application

  • On the click on the button we have to invoke the pop. To do that we have to write the following code in MainActivity.java

     
  • Button1 and Button2 perform the following function to invoke pop up.

     

tooltip-in-android-tutorial

That’s it my friends now our application is ready for deploy. If you have any suggestion or any query then do comment below. We will be happy to help you.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.