【发布时间】:2014-12-19 10:35:09
【问题描述】:
我正在尝试找出使用自定义字体作为工具栏标题的正确方法,并将其置于工具栏中(客户要求)。
目前,我正在使用旧的 ActionBar,并将标题设置为空值,并使用 setCustomView 放置我的自定义字体 TextView 并使用 ActionBar.LayoutParams 将其居中。
有没有更好的方法来做到这一点?使用新的 Toolbar 作为我的 ActionBar。
【问题讨论】:
-
MaterialToolbar 支持居中工具栏,也支持更改字体,见:material.io/components/app-bars-top/…
标签: android android-layout android-toolbar android-theme android-styles