问题描述
我想使用自定义字体上的的TextView
。该的TextView
文本设置为 textView1.setText(Html.fromHtml(的htmlText));
I'm trying to use a custom font on a TextView
. The TextView
text is set with textView1.setText(Html.fromHtml(htmlText));
该HTML包含粗体和斜体跨度
The html contains bold and italic spans
现在。我购买了自定义字体。字体配备了3个不同的文件(TTF)。一个定期,一是大胆和倾斜。
Now. I purchased a custom font. The font comes with 3 different files (ttf). One for regular, one bold and for italic.
如何申请这三个字体文件复制到的TextView?
How can I apply those three font files to the textview?
推荐答案
这个链接将帮助您了解如何定制Android的字体:的
This link will help you to see how to customize android font: http://mobile.tutsplus.com/tutorials/android/customize-android-fonts/
在它涉及如何将这些字体文件适用于TextView的,你需要将它们先在你的项目中集成:
In which concerns how to apply those font files to the textview, you need to integrate them first in your project:
Typeface tf = Typeface.createFromAsset(this.getAssets(),
"fonts/xxx.TTF");
txt1.setTypeface(tf);
在TTF文件应该被放置在 - >资产/字体/ xxx.TTF
The ttf file should be placed in --> assets/fonts/xxx.TTF
需要的所有细节都在一段话:使用自定义字体
All needed details are in the paragraph: "Using Custom Fonts"
这篇关于HTML用不同字体的粗体和斜体文本视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!