Android 沿着线绘制文字

public class DrawLineActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    public void drawLine(View view){
        Paint paint = new Paint();
        paint.setColor(Color.GREEN);
        paint.setTextSize(20);
        paint.setTypeface(Typeface.DEFAULT);
        Path path = new Path();
        path.moveTo(20, 20); //起点
        path.lineTo(100, 20);
        path.lineTo(200, 220);
        Canvas canvas = new Canvas();
        canvas.drawTextOnPath("kkkkkkkkkkk", path, 0, 0, paint);
    }
}

你可能感兴趣的:(android)