提问者:小点点

可下载字体异常


我决定在我的项目中使用可下载字体。我实现了指南中建议的所有内容。

下一步,当我尝试从ResourcesCompat获取字体时,出现了以下问题:

ResourcesCompat.getFont(MainActivity.this, R.font.roboto_bold)

在那之后,我总是得到这样的体验:

Font resource ID #0x7f090005 could not be retrieved

如何解决这个问题?

PS:

  1. support-compat库v27
  2. min sdk 16
  3. 通过ResourcesCompat解决方案。FontCallback在我的情况下不是一个好方法
  4. 问题发生在有和没有Google Play服务的设备上

共1个答案

匿名用户

引用自https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts.html#via-android studio:

您可以使用Android Studio 3.0将应用程序设置为下载字体。为了帮助您开始使用可下载字体功能,您可以使用Google Play services的字体提供商。

注意:设备必须具有Google Play services 11或更高版本才能使用Google字体提供程序。