Downloadable Fonts Exception

送分小仙女□ 提交于 2019-12-23 20:23:15

问题


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

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

How to solve this problem?

PS:

  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

回答1:


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

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.

Note: A device must have Google Play services version 11 or higher to use the Google Fonts provider.



来源:https://stackoverflow.com/questions/48815918/downloadable-fonts-exception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!