I've got a PopupWindow 'mPlayPopup' that I want to get displayed just below a certain View 'mPlayButton'. Here's how I do it:
mPlayButton = new Button(activity);
mPlayButton.setOnClickListener( new View.OnClickListener()
{
@Override
public void onClick(View view)
{
mPlayPopup.showAsDropDown(view, 10, 10);
mPlayPopup.update(view, mPlayPopupWidth, mPlayPopupHeight);
}
});
Simple - and it works in most cases, except when the app itself is in 'multi-window' or 'pop-up window' mode and its top-left corner is not the top-left corner of the screen.
In those cases, the mPlayPopup still pops up as if the top-left corner of the app was the top-left corner of the whole screen, which, if I open up my app in 'pop-up mode' and move it to the bottom of the whole screen - is well outside the window of the app itself.
How can I handle such case correctly?