删除ActionBar字幕/重置ActionBar文本 [英] Remove ActionBar subtitle / Reset ActionBar text

查看:183
本文介绍了删除ActionBar字幕/重置ActionBar文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前在某些页面上设置了ActionBar字幕,但是在某些页面上我不想设置字幕.

I'm currently setting the ActionBar subtitle on certain pages, but on some pages i don't want to have a subtitle.

我可以简单地将字幕文本设置为空,但这只会删除文本.它仍然占据字幕空间,因此将标题推高. 可能很难解释,所以我用图片进行了说明:

I can simply set the text of the subtitle to nothing, but this just removes the text. It still occupies the subtitle space and thus pushes the title up. It can be hard to explain, so i illustrated with a picture:

1)此显示未设置字幕的ActionBar,这就是我想要设置的方式.

1) This show the ActionBar with no subtitle set, which is how i want to be able to set it.

2这显示了带有字幕的ActionBar,这就是我想在某些页面上显示它的方式.

2 This shows the ActionBar with a subtitle set, which is how i want to show it on some pages.

3)最后,这是ActionBar在设置字幕并尝试将其删除后的外观. 如您所见,标题已被推高,字幕没有消失,只是没有显示任何内容.

3) And finally, this is how the ActionBar looks after i set a subtitle and try to remove it. As you can see, the title has been pushed up and the subtitle is not gone, it's just not showing anything.

我希望有人可以帮我解决这个问题,我已经尝试过搜索问题,已经在android的官方网站上进行了挖掘,找到了getActionBar().ResetSubtitle()或类似名称,但是到目前为止,我空手而归.

I hope someone can help me out with this, i've tried googling the problem, i've digged through the official android website to find a getActionBar().ResetSubtitle() or similar, but so far i've come up empty handed.

推荐答案

调用ActionBar.setSubtitle(null),这会将字幕TextView的可见性更改为View.GONE.

Call ActionBar.setSubtitle(null), this will change the visibility of the subtitle TextView to View.GONE.

来源

ActionBarView. setSubtitle

这篇关于删除ActionBar字幕/重置ActionBar文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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