Set image in action bar

2019-08-29 11:26发布

问题:

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);