Android examples for java.lang:Math Geometry
draw Multi Line Text on Canvas
//package com.java2s; import android.graphics.Canvas; import android.graphics.Paint; public class Main { public static void drawMultiLineText(Canvas canvas, String text, int x, int y, Paint paint) { drawMultiLineText(canvas, text, x, y, paint, 1); }/* ww w .j ava2 s. co m*/ public static void drawMultiLineText(Canvas canvas, String text, int x, int y, Paint paint, float lineHeight) { String[] lines = text.split("\n"); for (String line : lines) { canvas.drawText(line, x, y, paint); y += (-paint.ascent() + paint.descent()) * lineHeight; } } }