java - 无法在 Android Studio 中使用 getFont

标签 java android android-studio gradle android-gradle-plugin

我必须在 Android studio 中使用 uset getFont 的最低要求,这是我的 gradle

My Gradle Informatiaon

这是我使用getFont时的错误通知

My Error Notification

最佳答案

您收到该错误的原因是 minSdkVersion 定义了您的应用程序有资格运行的最低版本。

minSdkVersion: An integer designating the minimum API Level required for the application to run. The Android system will prevent the user from installing the application if the system's API Level is lower than the value specified in this attribute. You should always declare this attribute.

您可以使用支持框架中的此方法来获取所有旧版本的字体:

ResourcesCompat.getFont(context, font_id)

https://developer.android.com/reference/android/support/v4/content/res/ResourcesCompat

关于java - 无法在 Android Studio 中使用 getFont,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51344535/

相关文章:

java - 具有不同帧速率的动画 gif 使用 Java 加载不正确

java - Apache OpenNLP 词性标注器 : Trained on which data set?

java - 使用 java、spring 的 solr 中的前 10 个结果

android - Android 操作系统代码库中的 ActiveSync/MS 交换源在哪里

android - 从 JobService 观察 LiveData

android - Google Play 说我使用 Android Studio Build->Generate Signed APK 构建的 APK 是可调试的

java - 可以在双向关系中创建两列吗?

java - Android java.lang.illegalargumentException 无法找到 native 库 main

java - Android Studio 报告 "android sdk is parsed incorrectly"

android-studio - 如何在状态栏 "click to let google know .."中隐藏Android Studio反馈的笑脸图标?