首页 > 解决方案 > 更改操作栏默认标题标签的文本和样式

问题描述

我创建了一个带有导航抽屉活动的新项目。默认情况下,我在操作栏中得到一个标题,如下所示。

在此处输入图像描述

我想更改“媒体行”文本并更改字体和大小。我搜索了整个项目,找不到这个标题的设置位置。我是初学者。

标签: androidandroid-actionbarandroid-appbarlayout

解决方案


如果您正在从事活动,请尝试以下操作:

ActionBar actionBar = getSupportActionBar();
actionBar.setTitle("Your title goes here");
//see the other attributes for actionBar for the color and the size 

如果您使用的是片段:

((AppCompatActivity)).getSupportActionBar()).setTilte("your title");

推荐阅读