使用TypefaceCompat 设置typeface 在 android 6.0 以上版本会导致兼容性问题而闪退
Typeface typeface
= TypefaceCompat
.createFromResourcesFontFile(context
,resource
, R
.font
.yourfont
, "", 0);
替换以下代码可以解决兼容性问题并实现相同功能
Typeface typeface
= ResourcesCompat
.getFont(context
,R
.font
.yourfont
)
转载请注明原文地址: https://win8.8miu.com/read-11605.html