【问题标题】:setFontFeatureSettings error noSuchMethodErrorsetFontFeatureSettings 错误 noSuchMethodError
【发布时间】:2015-10-23 05:23:03
【问题描述】:

我想把数字写成交替分数。

1
_<BR>
2

而不是1/2。为此我使用了代码

Typeface typeface = Typeface.createFromAsset(getAssets(), "Nutso2.otf");
vText.setTypeface(typeface);

vText.setText("1/2");
vText.setFontFeatureSettings("afrc");

但我收到此错误

com.example.kashif.equationsolver E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.example.kashif.equationsolver, PID: 4746
    java.lang.NoSuchMethodError: android.widget.TextView.setFontFeatureSettings
            at  com.example.kashif.equationsolver.MainActivity$3.onClick(MainActivity.java:331)
            at android.view.View.performClick(View.java:4438)
            at android.view.View$PerformClick.run(View.java:18422)
            at android.os.Handler.handleCallback(Handler.java:733)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5001)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at     com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
            at dalvik.system.NativeStart.main(Native Method)

【问题讨论】:

  • 仅将 I 大写并固定语法。它需要的是更多的代码,而不是编辑。

标签: android css fonts typeface


【解决方案1】:

setFontFeatureSettings 很遗憾只能从 Lollipop (21) 开始使用,之前你不能使用它!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-10-10
    • 2015-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多