anchor popup menu over overflow button

后端 未结 3 922
挽巷
挽巷 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:23

    I learnt how to get a view from a menuitem here: Android : Get view Reference to a Menu Item

    1. Call View v = findViewById(R.id.overflow) within your onOptionsItemSelected method.

    2. Use that view as your anchor in your popupmenu: PopupMenu popupMenu = new PopupMenu(this, v);

提交回复
热议问题