Java tutorial
//package com.java2s; import android.graphics.Paint; import android.graphics.Rect; public class Main { public static Rect getTextRect(String text, float size) { Paint pFont = new Paint(); pFont.setTextSize(size); Rect rect = new Rect(); pFont.getTextBounds(text, 0, text.length(), rect); return rect; } }