android绘制文字

1:android绘制文字呢,首先要新建一个继承view的类:

public class CircleSwitchView extends View {
	
}

2:重写onDraw方法

@Override
	protected void onDraw(Canvas canvas) {
		super.onDraw(canvas);
		
		Paint paint=new Paint();
<span style="white-space:pre">		</span>paint.setAntiAlias(true);
		paint.setColor(0xffffffff);//颜色
		paint.setTextSize(25);//字体大小
		canvas.drawText("close", bRadius * 3, bRadius, paint);
		canvas.restore();
		paint.reset();
	
	}


你可能感兴趣的:(android绘制文字)