V. Raman
V. Raman

Reputation: 221

Pop up window / show as drop down

popupwindow_obj.showAsDropDown(clickbtn, -40, 18); // where u want show on view click event popupwindow.showAsDropDown(view, x, y);

Why is it that it is needed to specify absolute x and y co-ordinate values for pop up window object to be shown as drop down? Why does it eventhough not automatically show nearby of the control item that has been clicked enough, only for a one single time all though, once upon a time?

Thank you in advance.

Upvotes: 1

Views: 2775

Answers (1)

FlyingNades
FlyingNades

Reputation: 452

From the android docs:

without cords

void showAsDropDown(View anchor) Display the content view in a popup window anchored to the bottom-left corner of the anchor view.

with cords:

void showAsDropDown(View anchor, int xoff, int yoff) Display the content view in a popup window anchored to the bottom-left corner of the anchor view offset by the specified x and y coordinates.

From these 2 methods we can learn that there are 2 (actually 3) showAsDropDown methods.

The one without cords will do what you want automatically in the bottom-left corner. And the one with cords will just take some offset from the bottom-left corner. the offset will be determined by you (int xoff, int yoff), xoff stands for x offset and yoff stands for y offset.

Source

Upvotes: 3

Related Questions