Kyros Kyros - 5 months ago 9
Android Question

Get the view from the action bar menu item

I have a

PopupWindow
that I want to anchor to an action bar menu item but can't seem anyway to get at the
View
of the item that I want to click on.
This is required for the
PopupWindow
showAsDropDown()
method.

Does anyone know how to achieve this?

Answer

You can get the view using the menu item id, by getting it in onOptionsItemSelected ..

findViewById(R.id.menu_item);