get String Width via TextPaint - Android android.text

Android examples for android.text:TextPaint

Description

get String Width via TextPaint

Demo Code

import android.text.TextPaint;

public class Main {

  public static float getStringWidth(String str, TextPaint paint) {
    float strWidth = paint.measureText(str);
    return strWidth;
  }/*  w  ww .j  a v a 2s  .c om*/

}

Related Tutorials