如何获得动作条意见的对象? [英] How to get actionbar views objects?

查看:117
本文介绍了如何获得动作条意见的对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法,你可以得到动作条意见的对象引用。比如我想获得的溢出视图,以便知道屏幕上的坐标。目前我管理一个丑陋的解决方案是。得到一个菜单项与ID

overflowView =((ViewGroup中)parent.findViewById(R.id.menu_id).getParent())getChildAt(2);

解决方案
  

有没有一种方法,你可以得到动作条意见的对象引用。

只有那些你自己创建的,通过安卓actionLayout 和亲属

  

比如我想获得的溢出视图,以便知道屏幕上的坐标。

您的解决方案是不可能维持平稳跨越的Andr​​oid版本。它可能或可能对ActionBarSherlock无法正常工作。我建议你​​找到任何你认为你的问题是,不涉及瞎搞与动作条实施内部一些其他的解决办法。

Is there a way that you can get actionbar views as object references. For instance I would like to get the overflow view in order to know the coordinates on the screen. currently I have manage an ugly solution which is. Get a menu item with an id

overflowView =((ViewGroup)parent.findViewById(R.id.menu_id).getParent()).getChildAt(2);

解决方案

Is there a way that you can get actionbar views as object references.

Only the ones you create yourself, via android:actionLayout and kin.

For instance I would like to get the overflow view in order to know the coordinates on the screen.

Your solution is unlikely to remain stable across Android versions. It may or may not work on ActionBarSherlock. I would recommend that you find some other solution for whatever you perceive your problem to be that does not involve messing around with the internals of the ActionBar implementation.

这篇关于如何获得动作条意见的对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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