get Paint Text Bounds - Android Graphics

Android examples for Graphics:Paint

Description

get Paint Text Bounds

Demo Code


//package com.java2s;

import android.graphics.Paint;

import android.graphics.Rect;

public class Main {
    public static Rect getTextBounds(String text, Paint paint) {
        Rect rect = new Rect();
        paint.getTextBounds(text, 0, text.length(), rect);
        return rect;
    }/*w  w  w  .j a  v a 2s  .  c o  m*/
}

Related Tutorials