question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not able to position the popup menu below the view anchor

See original GitHub issue

I am not able to position the popup menu below the view anchor like in this picture:

https://csharpcorner-mindcrackerinc.netdna-ssl.com/article/pop-up-menu-android-application/Images/image012.png

I have tried to set dropdownGravity = Gravity.BOTTOM without success. I have also tested with other Gravity constants (i.e END, START, TOP, etc.) but wasn’t able to achieve the desired result.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
zawadz88commented, Aug 21, 2018

I have something ready which you might try here (See “Custom offsets” sample): https://github.com/zawadz88/MaterialPopupMenu/tree/feature/custom-offsets

Using dropdownGravity seems like a more generic approach though, but it’ll require further investigation as depending on the amount of space available (top/bottom of the screen) the results might differ.

1reaction
ogasimlicommented, Aug 21, 2018

Hi @zawadz88,

Thanks for your time. I also think that it is vital to be able to position the Menu. In my case, I am animating the icon when popup menu is opened and closed. Therefore, this feature was very important to me. Also, I noticed that there is no OnCloseListener. I think that it will be a good enhancement either.

Because of these 2 issues, I decided to create my own custom PopupWindow. Nevertheless, thanks for this great library.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How change position of popup menu on android overflow ...
Just put an invisible view to where you want the popup menu to anchor: <View android:id="@+id/anchor_menu" android:layout_width="0dp" ...
Read more >
Menus and Popups | CodePath Android Cliffnotes
PopupMenu - A modal menu that is anchored to a particular view within an activity. The menu appears below that view when it...
Read more >
PopupMenu - Android Developers
The popup will appear below the anchor view if there is room, or above it if there is not. If the IME is...
Read more >
How To Trigger A Popup From A Nav Menu Item - Elementor
In the Advanced tab of the Popup Settings, we will add a small code snippet into the Open By Selector field. For this...
Read more >
Change Desktop & Dock settings on Mac - Apple Support (AZ)
Locate the Dock along the left, bottom, or right edge of the screen. ... On Desktop Only: Hide and show the menu bar...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found