操作栏删除标题和回收空间 [英] Action Bar remove title and reclaim space
问题描述
我想从我的动作栏中删除标题和回收它,否则消耗的使用菜单项的空间。
I am trying to remove the title from my action bar and reclaim the space it would otherwise consume for the use of menu items.
我使用的是自定义主题都试过,但到目前为止没有奏效。我试图改变文字大小0SP,改变颜色为透明,并设置能见度走了。
I have tried using a custom theme but so far nothing has worked. I have tried changing the text size to 0sp, changing the color to transparent, and setting visibility to gone.
我也试过这样的:
ActionBar actionbar = getActionBar();
actionbar.setDisplayShowTitleEnabled(false);
我定位SDK 15+,并使用标准的Android操作栏(即不是福尔摩斯)。
I am targeting sdk 15+ and using the standard Android action bar (i.e. not Sherlock).
感谢您的任何建议。
下面就是我说的(镶上红色的区域,我想回去):
Here's what I'm talking about (the area bordered in red I want back):
推荐答案
你检查出的动作条的文件了吗?有一个方法,<一个href="http://developer.android.com/reference/android/app/ActionBar.html#setDisplayShowTitleEnabled%28boolean%29"相对=nofollow> setDisplayShowTitleEnabled(布尔)
,做你所需要的。
Did you check out the ActionBar documentation yet? There's a method, setDisplayShowTitleEnabled(boolean)
that does what you need.
只是得到一个引用您的动作条
,并呼吁与假
:
Simply get a reference to your ActionBar
, and call that with false
:
ActionBar actionBar = getActionBar();
actionBar.setDisplayShowTitleEnabled(false);
这篇关于操作栏删除标题和回收空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!