1
我使用以下代码来改变字体大小,以中等或高或小。 getFontSize()
将返回所有这些大小没有这样的方法错误而设置文本外观
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
holder.title.setTextAppearance(new AppController().getFontSize());
else
holder.title.setTextAppearance(mContext, new AppController().getFontSize());
但即时得到以下错误:
java.lang.NoSuchMethodError: No virtual method setTextAppearance(I)V in class Landroid/widget/TextView; or its super classes (declaration of 'android.widget.TextView' appears in /system/framework/framework.jar)
为什么会出现这样的错误?
看到这里https://code.google.com/p/android/issues/detail?id=183542 – rafsanahmad007
的问题,它看起来像编译器应该失败,但它不会因此在现场崩溃。 根据@ rafsanahmad007链接,我认为它与@弃用的方法有关。 –
你确定'新的AppController()。getFontSize()'返回'@StyleRes int'('int'表示一个样式资源)? –