贮备工作:需要先下载“数码管字体”,在网上搜数码管字体,一搜一大片,然后在assets中新建一个文件夹,将ttf格式的字体文件放里面
废话不多说,直接上代码
package com.example.shumaguan;
import android.os.Bundle;
import android.app.Activity;
import android.graphics.Typeface;
import android.view.Menu;
import android.widget.TextView;
public class ShuMaGuan extends Activity {
TextView hours;
TextView minuters;
TextView seconds;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_timer_out);
hours = (TextView) findViewById(R.id.hours);
minuters = (TextView) findViewById(R.id.minuters);
seconds = (TextView) findViewById(R.id.seconds);
Typeface face = Typeface.createFromAsset(getAssets(),
"fonts/****.ttf");
hours.setTypeface(face);
minuters.setTypeface(face);
seconds.setTypeface(face);
}
xml文件里的代码略。。。。。。