Chrisjenx的书法图书馆不起作用

时间:2016-08-13 12:02:57

标签: android fonts

我不认为我真的很了解自述文件,因为我的代码中有这个:

@Override
public void onCreate() {
    super.onCreate();
    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
            .setDefaultFontPath("fonts/trado.ttf")
            .setFontAttrId(R.attr.fontPath)
            .build());
}

@Override
protected void attachBaseContext(Context newBase) {
    super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
}

我的 assets 文件夹中有 trado.ttf 。这是我的Application课程。这就是我所做的一切,我错过了什么?

1 个答案:

答案 0 :(得分:4)

  • 覆盖attachBaseContext(...)中的Activity 类。
  • initDefault(...) Application内的onCreate()内容。
  • trado.ttf放入assets/fonts文件夹。
相关问题