draw Text on Canvas - Android Graphics

Android examples for Graphics:Canvas

Description

draw Text on Canvas

Demo Code


//package com.java2s;

import android.graphics.Canvas;

import android.graphics.Paint;

public class Main {
    public static void drawText(Canvas canvas, String text, float x,
            float y, Paint paint, float angle) {
        if (angle != 0F)
            canvas.rotate(angle, x, y);/*ww  w.ja  va 2s . co m*/

        canvas.drawText(text, x, y, paint);
        if (angle != 0F)
            canvas.rotate(-angle, x, y);
    }
}

Related Tutorials