获取操作栏中的菜单项的看法 [英] Get the view from the action bar menu item

查看:118
本文介绍了获取操作栏中的菜单项的看法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 PopupWindow 我要锚定到一个操作栏的菜单项,但似乎无法反正拿到的查看。 这是必需的 PopupWindow showAsDropDown()方法。

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?

推荐答案

您可以使用菜单项的ID,通过获取它 onOptionsItemSelected ..

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

findViewById(R.id.menu_item);

这篇关于获取操作栏中的菜单项的看法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆