get Paint Draw Text Height - Android Graphics

Android examples for Graphics:Paint

Description

get Paint Draw Text Height

Demo Code


//package com.java2s;

import android.graphics.Paint;

public class Main {

    public static int getDrawTextHeight(Paint paint) {
        Paint.FontMetrics fm = paint.getFontMetrics();
        return (int) Math.ceil(fm.descent - fm.ascent);
    }//from  w w  w.jav a 2  s  . com
}

Related Tutorials