在一个单一的活动中删除操作栏中的标题文字 [英] Remove the title text from the action bar in one single activity

查看:132
本文介绍了在一个单一的活动中删除操作栏中的标题文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加了一个下拉菜单中选择操作栏到我的活动,但它也显示了应用程序的名称。

I added an action bar with a dropdown menu to my activity but it also shows the application name.

我的每个活动都有一个操作栏,每个人使用的主题 @android:款式/ Theme.Holo.Light 。一一我的活动画面,我想显示的下拉/微调菜单操作栏,但我想隐藏应用程序标题。

Each of my activities has an action bar and each of them use the theme @android:style/Theme.Holo.Light. One one my activity screens I would like to display the action bar with the dropdown/spinner menu but I would like to hide the application title.

我看到该解决方案上的另一个SO后,但它要求我改变了全球主题设置,如果我理解正确,这种做法会从我的所有动作条中删除标题。

I saw this solution on another SO post but it required me changing the global theme settings and if I've understood correctly, that approach would remove the title from all my action bars.

我怎样才能做到这一点?

How can I do this?

下面是截图:

推荐答案

对于这种简单的东西,你就必须去到源找到了答案: 这里完整的解释: http://developer.android.com/guide/主题/ UI / actionbar.html#下拉

For this kind of simple stuff you just have to go to the source to find the answer: here the full explanation: http://developer.android.com/guide/topics/ui/actionbar.html#Dropdown

和这里的一些指导code,包括在操作栏上的微调:

and here some guide code, to include the spinner on the action bar:

 ActionBar actionBar = getActionBar();
 actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

之后,这只是把一个侦听器的更改,并设置一个微调适配器。

after that is just put a listener for the changes and setting the a spinner adapter.

和您可以使用:

 setTitle("");

要删除的称号。 我一直在检查我的codeS在这里,你也可以给一个尝试:

to remove the title. I've been checking on my codes here, you can also give a try on:

 requestWindowFeature(Window.FEATURE_NO_TITLE);

这应该只是去掉标题,并留下标题栏。请记住,你必须在的setContentView

快乐编码。

这篇关于在一个单一的活动中删除操作栏中的标题文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆