【问题标题】:How to add Textview below Actionbar title [duplicate]如何在操作栏标题下方添加 Textview [重复]
【发布时间】:2016-04-12 20:24:13
【问题描述】:

我们如何在默认操作栏标题下方添加一个 Textview?

我已经用谷歌搜索并尝试了自定义操作栏视图,但它会改变其他操作栏功能。有什么参考吗?

【问题讨论】:

  • 查看我的this答案
  • 我已经提到我尝试过使用服装动作栏视图,所以它没有帮助。

标签: android android-actionbar


【解决方案1】:

您可以使用 setSubtitle

设置操作栏的副标题。仅在以下情况下才会显示 DISPLAY_SHOW_TITLE 已设置。设置为 null 以禁用字幕 完全。

ActionBar ab = getActionBar(); //getSupportActionBar()
 ab.setTitle("App Title");
 ab.setSubtitle("App sub-title");  

您可以查看Setting Action Bar title and subtitle

【讨论】:

    【解决方案2】:

    将此代码添加到您的代码中

            ActionBar ab = getActionBar();
            ab.setTitle("My Title");
            ab.setSubtitle("sub-title"); 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-08
      • 2013-03-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多