【发布时间】:2011-04-02 07:41:47
【问题描述】:
如何将音乐字体导入 Eclipse 以支持音乐 unicode?任何解决方法?
【问题讨论】:
标签: android eclipse unicode fonts
如何将音乐字体导入 Eclipse 以支持音乐 unicode?任何解决方法?
【问题讨论】:
标签: android eclipse unicode fonts
这是最简单的。
在项目的根目录中创建一个名为 assets/fonts/ 的文件夹,然后粘贴 TTF 字体文件(在本例中为 Verdana.ttf)。然后,如果您想将该字体应用到 TextView,请执行以下操作:
public class FontSampler extends Activity {
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
TextView tv=(TextView)findViewById(R.id.custom);
Typeface face=Typeface.createFromAsset(getAssets(),
"fonts/Verdana.ttf");
tv.setTypeface(face);
}
}
此示例取自 ComonsWare 书(由 Mark Murphy 撰写)。你可以 download the full example from GitHub 。
【讨论】: