get Text Length via Paint - Android Graphics

Android examples for Graphics:Paint

Description

get Text Length via Paint

Demo Code


//package com.java2s;

import android.graphics.Paint;

public class Main {
    public static float getTextLength(float textSize, String text) {
        Paint paint = new Paint();
        paint.setTextSize(textSize);/*w w w .java  2s. c om*/
        return paint.measureText(text);
    }
}

Related Tutorials