android - 使用 "font"资源文件的 Android 字体未更改

标签 android android-resources android-fonts

按照 Android Studio 3 中使用字体的新方式,我在 res 中添加了字体资源文件夹,并在其中添加了我的 .ttf 字体,然后在 xml 文件中引用它们,如下所示:

                    <TextView
                    android:id="@+id/tv_about"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_margin="8dp"
                    android:text="@string/about_info"
                    android:textColor="@color/tin"
                    android:textSize="23sp"
                    android:fontFamily="@font/diana" />

编译正常但不工作,字体没有改变。

最佳答案

您需要针对 API 级别 26+ (Oreo) 并安装支持库 26.0.0+ 才能应用 res/font 中的字体。

关于android - 使用 "font"资源文件的 Android 字体未更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46080350/

相关文章:

android - 警告:字符串 'prediction_none'没有默认翻译

android - 如何使用自定义字体设置 Spannable 对象字体

android - LinkedIn Rest API,状态 token 不匹配

java - 如何开发使用 Android 源代码中的 C 文件的应用程序

Android 应用程序无法针对小型设备正确缩放

android - 如何区分16 :9 display from a 18:9 one?

android - 如何将 alpha channel 添加到 xml 中的现有 Android 颜色

android - TextView 中的乌尔都语字体

android - Lollipop 按钮上的自定义字体

android - 我如何在 Android 中快速比较电话号码?