Skip to content Skip to sidebar Skip to footer

Android. How To Show Popup Window Directly Above Button

I need to show popup window directly above button. My button is placed inside scroll view, and popup always shown below button. Here is my code: private void showPopup(View view,

Solution 1:

When you have to show the popup, find out the location of the button in the screen, then use the showAtLocation() method as Prachi Said using Gravity.TOP and the x,y coordinates of the button on screen...

Solution 2:

Change Gravity to Top and reset your coordinates according to your requirement.

infoPopup.showAtLocation(view, Gravity.TOP, 0, (int) view.getY());

Post a Comment for "Android. How To Show Popup Window Directly Above Button"