Android开发LCD字体

use*_*602 8 fonts android

如何在android环境中添加其他字体?我需要制作像LCD这样的字体,背景颜色很浅,如下所示:

http://www.androidfreeware.net/img2/gps_speedometer_android_1.png

the*_*abh 35

我们在bangalore android开发人员小组为我们的一个项目AutoMeter做了这个你可以详细看一下那里的代码.

代码看起来像这样

Typeface myTypeface = Typeface.createFromAsset(this.getAssets(),"DS-DIGIB.TTF");
waitingTimeView = (TextView) findViewById(R.id.WaitingTime);
waitingTimeView.setTypeface(myTypeface);
Run Code Online (Sandbox Code Playgroud)

DS-DIGIB.TTF是置于assets文件夹中的字体


ios*_*per 12

public void setFontTextView(Context c, TextView name) {
Typeface font = Typeface.createFromAsset(c.getAssets(),"fonts/Arial.ttf");
name.setTypeface(font);
}
Run Code Online (Sandbox Code Playgroud)

在ttf文件格式中下载Arial字体并放入资产文件夹.多数民众赞成.


Yan*_*min 6

您想使用android.graphics.Typeface类,它可以从资产或文件创建新的字体.