Example usage for android.text Layout getDesiredWidth

List of usage examples for android.text Layout getDesiredWidth

Introduction

In this page you can find the example usage for android.text Layout getDesiredWidth.

Prototype

public static float getDesiredWidth(CharSequence source, int start, int end, TextPaint paint) 

Source Link

Document

Return how wide a layout must be in order to display the specified text slice with one line per paragraph.

Usage

From source file:Main.java

public static int getTextLen(TextView textView) {
    TextPaint paint = textView.getPaint();
    return (int) Layout.getDesiredWidth(textView.getText().toString(), 0, textView.getText().length(), paint);
}