如何使用粗体创建自定义字体系列 [英] How to create custom font family with bold font
本文介绍了如何使用粗体创建自定义字体系列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用此文档 https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml.html 的问题在于,没有粗体属性,并且我不能以编程方式将其设置为XML字体吗?
I'm trying to create custom font family using this doc https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml.html The problem in that that there is no bold attribute and I can not set it programmatically Fonts in XML?
推荐答案
将700设置为粗体字体的fontWeight值.
Set 700 as the fontWeight value for your font in bold.
在字体资源文档中:
最常见的值是常规重量的400和粗体的700 体重.
The most common values are 400 for regular weight and 700 for bold weight.
在龙虾字体系列示例中,您链接它将是:
In the lobster font family example you linked it would be:
<!-- bold -->
<font
android:fontStyle="normal"
android:fontWeight="700"
android:font="@font/lobster_bold" />
而且,如果您使用的是支持库:
And, if you are using support lib:
<!-- bold -->
<font
app:font="@font/lobster_bold"
app:fontStyle="normal"
app:fontWeight="700" />
这篇关于如何使用粗体创建自定义字体系列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文