可下载字体异常 [英] Downloadable Fonts Exception

查看:97
本文介绍了可下载字体异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I decided to use Downloadable fonts in my project. I implemented everything as recommened in the guide.

当我尝试通过 ResourcesCompat 获取字体时,发生以下问题:

The following problem occured, when i tried to get font from ResourcesCompat next way:

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

在那之后,我总是得到这个证据:

After that, i always get this exeption:

Font resource ID #0x7f090005 could not be retrieved

如何解决这个问题?

PS:

  1. support-compat库v27
  2. 最低SDK 16
  3. 通过 ResourcesCompat.FontCallback 进行的
  4. 解决方案对我而言不是一个好方法
  5. 在有和没有 Google Play服务
  6. 的设备上都会出现问题
  1. support-compat library v27
  2. min sdk 16
  3. solution via ResourcesCompat.FontCallback is not a good way in my case
  4. problem occurs on devices with and without Google Play Services

推荐答案

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

You can set your application to download fonts by using Android Studio 3.0. To help you get started with the Downloadable Fonts features, you can use the font provider from Google Play services.

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

这篇关于可下载字体异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆