문제

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.

도움이 되었습니까?

해결책

According to the source code of ActionBarView.HomeView you should be able to get ImageView of icon by android.R.id.home.

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top