读书人

替数字添加LCD效果

发布时间: 2012-08-25 10:06:20 作者: rapoo

为数字添加LCD效果

我们有时想为数据添加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 styleTypeface lcdFont = Typeface.createFromAsset(getAssets(),"fonts/lcd2mono.ttf");txtMineCount.setTypeface(lcdFont);txtTimer.setTypeface(lcdFont);

?

?

1 楼 vanlzh 2011-09-19 不错,正需要

读书人网 >移动开发

热点推荐