Android Utililty Methods String Width Get

List of utility methods to do String Width Get

Description

The list of methods to do String Width Get are organized into topic(s).

Method

intdisplayWidth(String s)
Returns the approximate display width of the string, measured in units of ascii characters.
int width = 0;
int len = s.length();
for (int i = 0; i < len; ++i) {
    width += displayWidth(s.charAt(i));
return width;
intgetStringsWidth(TextPaint paint, String text)
get the width for a string with specified paint.
Rect rect = new Rect();
paint.getTextBounds(text, 0, text.length(), rect);
return rect.width();