Set image in action bar

半腔热情 提交于 2020-01-05 08:28:59

问题


I have set image in Actionbar using

ActionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.header));

and also removed "android:icon="@drawable/header" from manifest.xml

but I am getting one image overlapped over other. I am attaching snapshot.

I want to display only my image.


回答1:


getActionBar().setDisplayShowHomeEnabled(false);

add this in your code you will get the desired output!!!




回答2:


Use this code:

getActionBar().setIcon(android.R.color.transparent);


来源:https://stackoverflow.com/questions/25911910/set-image-in-action-bar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!