measure Text Height using Font Metrics - Android Graphics

Android examples for Graphics:Font

Description

measure Text Height using Font Metrics

Demo Code


//package com.java2s;

import android.graphics.Paint;

public class Main {

    public static float measureTextHeight(Paint paint) {
        Paint.FontMetrics fm = paint.getFontMetrics();
        float height = fm.bottom - fm.top;

        return height;
    }/* w  ww  .ja  va2 s .  com*/
}

Related Tutorials