【发布时间】:2015-11-24 21:27:53
【问题描述】:
使用自定义字体后,我无法通过以下方式获取文本视图的字体样式(BOLD、ITALIC、BOLD_ITALIC):
textView.getTypeface.getStyle();
实际上设置新的字体样式并不适用于 textView,虽然我们可以看到样式在视觉上发生了变化。我这样设置字体样式:
Typeface font = Typeface.createFromAsset(getAssets(), "sampleFont.ttf");
textView.setTypeface(font, Typeface.BOLD);
但是,
textView.getTypeface.getStyle();
返回 0(正常)而不是 1(粗体)! 当我尝试使用常规字体时,所有这些都会发生。
【问题讨论】:
标签: android fonts typeface custom-font android-fonts