The action bar removes the name and frees up space

I am trying to remove the title from my action bar and return the space that otherwise it would use to use the menu items.

I tried using a custom theme, but so far nothing worked. I tried to resize the text to 0sp, changing the color to transparent and changing the visibility.

I also tried this:

ActionBar actionbar = getActionBar(); actionbar.setDisplayShowTitleEnabled(false); 

I am targeting sdk 15+ and use the standard Android action bar (i.e. not Sherlock).

Thanks for any suggestions.

Here's what I am saying (the area bordering red, I want to return):

Actionbar

+4
source share
1 answer

Have you checked the ActionBar documentation yet? There is a setDisplayShowTitleEnabled(boolean) method that does what you need.

Just get the link to your ActionBar and call it with false :

 ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(false); 
0
source

Source: https://habr.com/ru/post/1433087/


All Articles