I've got a Button, and upon clicking it I would like to show a PopupWindow. The Window should be displayed just above the Button.
I have read: Android - PopupWindow above a specific view
where the approved answer is
popupWindow.showAsDropDown(anchor, 0, -anchor.getHeight()-popupView.getHeight);
but the trouble is, I don't know what's the height of my popupWindow - it is created programatically, and before calling the showAsDropDown
its getHeight
method returns -2 ( WRAP_CONTENT? ).
If I use appropriate constant like so
popupWindow.showAsDropDown(anchor, 0, -anchor.getHeight()-530, Gravity.LEFT);
then it works. The question is thus more precisely 'how do I display a programatically created PopupWindow of height LayoutParams.WRAP_CONTENT
above a given anchor View?'