我知道如何设置的动作条的图标,但我怎么确定哪些图标,目前有?我没有看到像调用getIcon
的访问,我认为这是可以通过ID查找图标视图,因为我已经在动作条做到了这一点与搜索窗口小部件,但我不知道叫什么ID。
I know how to set the icon of the actionbar, but how do I determine what icon is currently there? I don't see an accessor like getIcon
, I think it is possible to find the icon view by id, since I've done this with the search widget in the actionbar, but I wouldn't know what id to call.
据 ActionBarView.HomeView
来源$ C $ C,你应该能够得到的ImageView
图标由 android.R.id.home
。
According to the source code of ActionBarView.HomeView
you should be able to get ImageView
of icon by android.R.id.home
.
所以,code可能看起来像:
So code may look like:
ImageView imageView = (ImageView) findViewById(android.R.id.home);
Drawable dr = imageView.getDrawable();
不知道这是否会与支持库
Not sure if this will work with support libraries