anchor popup menu over overflow button

后端 未结 3 921
挽巷
挽巷 2020-12-11 06:01

I\'m trying to create a custom popup menu that I would like to position on the overflow menu button of the actionbar (am using a Toolbar with setSupportA

3条回答
  •  执笔经年
    2020-12-11 06:42

    Instead of having an actual overflow menu you could "cheat" a little bit. Have an icon in your actionbar that looks like the overflow icon. You should set showAsAction to always on this MenuItem. OnClick of the overflow icon, you show a ListPopupWindow that's anchored to the MenuItem view. If the ListPopupWindow doesn't show up where you want it to, you can call ListPopupWindow.setHorizontalOffset() and ListPopupWindow.setVerticalOffset()

提交回复
热议问题