标签:
1.首先要把我们的字体放到手机的目录下,
我们的字体是放到了/system/fonts/ 目录下面了
2.在代码中进行设置
import android.graphics.Paint; import android.graphics.Typeface; import java.io.File; private static final String SYSTEM = "/system/fonts/"; private static final String SYSTEM_FONT_TIME_BACKGROUND = SYSTEM + "FunuiNumber-Regular.ttf"; private static Typeface sClockTypeface; private static Typeface sStandardTypeface; mDisResult = (TextView) findViewById(R.id.dis_result); File fileTTF = new File(SYSTEM_FONT_TIME_BACKGROUND); sStandardTypeface = Typeface.DEFAULT; if (sClockTypeface == null && fileTTF.exists()) { sClockTypeface = Typeface .createFromFile(SYSTEM_FONT_TIME_BACKGROUND); } Paint paint = mDisResult.getPaint(); paint.setTypeface(fileTTF.exists() ? sClockTypeface : sStandardTypeface);
标签:
原文地址:http://www.cnblogs.com/zhangshuli-1989/p/zhangshuli_typeface_150316142.html