我们有时想为数据添加LCD效果,例如实现计时器时,我们想实现类似LCD显示屏那样的跳动效果,如图
首先,我们需要在assets目录下创建一个ttf文件fonts\lcd2mono.ttf
在android代码中如下使用
txtMineCount = (TextView) findViewById(R.id.MineCount);
txtTimer = (TextView) findViewById(R.id.Timer);
// set font style for timer and mine count to LCD style
Typeface lcdFont = Typeface.createFromAsset(getAssets(),
"fonts/lcd2mono.ttf");
txtMineCount.setTypeface(lcdFont);
txtTimer.setTypeface(lcdFont);