Android开发:自定义字体

1、定义画笔和字体样式
Paint btnPaint;
Typeface mFace;

2、实例化画笔及字体
btnPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
btnPaint.setColor(0xff1900ff);
btnPaint.setTextSize(30);
btnPaint.setTextAlign(Align.CENTER);

mFace = Typeface.createFromAsset(ct.getAssets(),"Boingo.ttf");
btnPaint.setTypeface(mFace);

3、写字咯!
canvas.drawText("String" ,x,y,btnPaint);

你可能感兴趣的:(android,String)