android 自定义字体 字体库 字体格式 使用攻略

来源:互联网 发布:0708赛季nba总决赛数据 编辑:程序博客网 时间:2024/06/07 09:38

先上图片;

\

\

\


部分关键代码:<喎�"http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vcD4KPHA+PHByZSBjbGFzcz0="brush:java;">public TextView makeText(String type,int size) { Typeface face = Typeface.createFromAsset(getAssets(), type); TextView tv = new TextView(this); tv.setText(R.string.helloChina); tv.setTypeface(face); tv.setTextSize(size); return tv; }

?
1
2
3
4
showLay.addView(makeText("fonts/MetaSerifOT-Book.ttf",12));
        showLay.addView(makeText("fonts/MetaSerifOT-Book.ttf",18));
        showLay.addView(makeText("fonts/MetaSerifOT-Book.ttf",24));
        showLay.addView(makeText("fonts/MetaSerifOT-Book.ttf",36));

字体库文件加载位置;

0 0