实现安卓中TextView,EditText中数字的数码管字体显示

贮备工作:需要先下载“数码管字体”,在网上搜数码管字体,一搜一大片,然后在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文件里的代码略。。。。。。

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值