Canvas.drawTextOnPath 2D绘图

绘制文字效果,如下图


protected void onDraw(Canvas canvas) 
{ 
    Paint paint = new Paint(); 
    paint.setTextSize(20); 
    Path path = new Path(); 
    //  绘制一个圆形的路径,文字会在该圆的上边缘外侧绘制 
    path.addCircle(100,100, 100, Direction.CW); 
    canvas.drawColor(Color.WHITE); 
    canvas.translate(50, 50); 
    paint.setTextAlign(Paint.Align.RIGHT); 
    canvas.drawTextOnPath("Android 开发权威指南", path, -55,0, paint); 
} 

猜你喜欢

转载自kingbinchow.iteye.com/blog/2095636