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 setSupportActionBar()
for this if it matters). I found out that this can be done with the setAnchorView()
(from reading Custom Menu item in Overflow menu).
However I cant seem to figure out how to retrieve the overflow menu as a view (that I could use to set the anchor with).
Also I did try anchoring this to the parent layout of the activity itself but it showed up on the left top, and the height of the menu was equal to the height of the actionbar (which is not very useful).
Does anyone know how this can be achieved?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…