我正在尝试更改工具栏标题的字体。
这是我的工具栏布局:
如果我不设置
非常感谢任何建议、评论或答案。
编辑:
我尝试将样式移动到
编辑2:
目前,我正在使用SpannableString和TypefaceSpan来解决这个问题。希望能对某些人有所帮助。
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="#666666"
app:titleTextAppearance="@style/MyText"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
而在我的 styles.xml 文件中
<style name="MyText">
<item name="fontPath">fonts/myFont.ttf</item>
</style>
如果我不设置
app:titleTextAppearance
,工具栏将使用系统字体。当我设置它时,字体变小了,但仍然是系统字体。我做错了什么吗?非常感谢任何建议、评论或答案。
编辑:
我尝试将样式移动到
styles-text.xml
,但没有成功。编辑2:
目前,我正在使用SpannableString和TypefaceSpan来解决这个问题。希望能对某些人有所帮助。