【发布时间】:2016-08-08 10:45:35
【问题描述】:
我正在使用 Calligraphy 库,除了在 Actionbar 中之外,它工作正常。我正在使用以下几行来进行书法工作
在 OnCreate() 中:
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
.setDefaultFontPath("fonts/Regular.ttf")
.setFontAttrId(R.attr.fontPath)
.build());
还有
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
}
使用 除操作栏外,所有字体都是自定义的。还需要添加其他步骤吗?
尝试了以下但错误说无法解析构造函数
SpannableString s = new SpannableString("My Title");
s.setSpan(new TypefaceSpan(this, "MyTypeface.otf"), 0, s.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
有什么选择吗?书法版——编译'uk.co.chrisjenx:calligraphy:2.2.0'
【问题讨论】:
标签: android fonts androiddesignsupport custom-font android-typeface