I am trying to add and action bar to my app, and customize it.

i used onCreateOptionMenu() and Inflaters to add to my code.

but i don't know how to customize background and remove that package name which appears next to the logo so i can give more "Room" to my items to be displayed correctly. can anybody help please?

Thank you in advance.

有帮助吗?

解决方案

I would suggest to create a custom action bar in layout folder and use it with below code:

ActionBar actionBar = getActionBar(); //Applications action bar isntance
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
actionBar.setCustomView(R.layout.my_action_bar);

If you use this, you can directly use action bar view's content and do whatever you want.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top