操作栏删除标题和回收空间操作、标题、空间

由网友(寒窗十载)分享简介:我想从我的动作栏中删除标题和回收它,否则消耗的使用菜单项的空间。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....

我想从我的动作栏中删除标题和回收它,否则消耗的使用菜单项的空间。

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+,并使用标准的Andr​​oid操作栏(即不是福尔摩斯)。

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

推荐答案

你检查出的动作条的文件了吗?有一个方法, 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);
阅读全文

相关推荐

最新文章