1

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?'

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.