Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android PopupWindow showAsDropDown() not working properly

I am using PopupWindow with showAsDropDown(anchor). When the anchor is at the top of the screen it works fine, but when at the bottom of the screen nothing shows up. According to the documentation for PopupWindow.showAsDropDown() this should work:

http://developer.android.com/reference/android/widget/PopupWindow.html#showAsDropDown%28android.view.View%29

"Display the content view in a popup window anchored to the bottom-left corner of the anchor view. If there is not enough room on screen to show the popup in its entirety, this method tries to find a parent scroll view to scroll. If no parent scroll view can be scrolled, the bottom-left corner of the popup is pinned at the top left corner of the anchor view."

Presumably, the popup is always anchored to the bottom-left corner of the anchor view. How do I fix this?

like image 806
meeeee Avatar asked Oct 29 '12 03:10

meeeee


Video Answer


1 Answers

You can try this .. may be it helps

mWindow.showAtLocation(mRootView, Gravity.BOTTOM|Gravity.LEFT, 0, distanceFromTop);
like image 179
GOLDEE Avatar answered Oct 24 '22 08:10

GOLDEE