Android使用自定义字体

在平时的开发中,我们经常会需要使用自定义字体,其实Android textView控件更换字体很简单。

1、将自定义字体放置到工程的assets下的fonts文件夹中,字体格式为tff。

2、textView选择自定义字体代码如下:

String content="test";
mText.setText(content);
Typeface tff = Typeface.createFromAsset(getAssets(), "fonts/game.ttf");
mText.setTypeface(tff);

 3、这样就实现了自定义字体的更换。附件为一些常用的字体

欢迎去下载我的软件体验:http://android.myapp.com/myapp/detail.htm?apkName=com.yln.history

猜你喜欢

转载自yaolinnan.iteye.com/blog/2184888