PopupWindow is used to show quick information or to get information from users. Popup windows have their own layout and there are different types of popup windows. We have already posted some tutorial posts like simple android alert dialog box example, toast message example, material design animated dialog box, etc. This time we are working with tooltip view. Tooltip is mostly used in web design but nowadays this is used by some android applications too.
In this tutorial, you will learn to implement tooltip view in your android application with little bit java code. Tooltip is mostly used to show quick information or tips to the users. It mostly contains only text with background and text color, but you may include image also. Tooltip is like the android toast, its physical targets can be specified and other many features with customization.
Android Example: How to Create Tooltip View with Arrow in Android
We are going to make tooltips view in android application/game by adding compile ‘it.sephiroth.android.library.targettooltip:target-tooltip-library:+’ dependency in build.gradle file. Following is the dependency part of build.gradle file.
Open your project XML layout file and add some buttons to show tooltip when the button is clicked with onClick attributes and unique id. Following is the sample content of XML layout file.
Now, it’s time to work in java activity file. Open your app java activity file and add the following code. You can change the direction of tooltip to right, bottom, left, top, center from Tooltip.Gravity.BUTTOM. Following is the complete code of java activity file.
That’s all. Run your Making Popup Window with ToolTips Arrow in Android application and click on any of the buttons you will see tooltip in different position with arrow. Your application will look like the above screenshot.