List of utility methods to do String Width Get
int | displayWidth(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; |
int | getStringsWidth(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(); |