【发布时间】:2020-03-11 12:28:32
【问题描述】:
我想在我使用 androidx 的 android 应用上应用自定义字体(不支持库!!)
但是我通过搜索找到的所有方法都是支持库。
他们说使用 android.support.v7.widget.appcompatTextview。但是我必须使用androidx。
我尝试了很多东西
- 同时使用
<item name="android:fontFamily">@font/custom_font_family</item>
<item name="fontFamily">@font/custom_pen_font_family</item>
- 用于应用所有 API 级别。 /font 的 custom_font_family.xml
android:font="@font/nanumbarunpen"
android:fontStyle="normal"
android:fontWeight="400"
app:font="@font/nanumbarunpen"
app:fontStyle="normal"
app:fontWeight="500" />
- 直接为小部件的属性设置值。
<TextView
android:fontFamily="@font/custom_font_family"
.../>
即使是那些尝试,也都被忽略了。
但是!预览正确显示自定义字体! (我的真实手机仍然没有变化......)
帮帮我....拜托,,,,....... TT
【问题讨论】:
-
您是否以编程方式为该文本视图设置任何内容?就像一种风格。
-
如果我使用 Typeface 将字体设置为 TextView,它正在工作。但实际上我需要更改整个应用程序的字体......所以这种方式有点困难