width:
Paint p = new Paint();
String s = "abc";
float width = p.measureText(s);
height:
Paint p = new Paint();
String s = "abc";
Paint.FontMetrics fm = p.getFontMetrics();
float height = fm.descent - fm.ascent;
垂直居中:
getMeasuredHeight() / 2 + (p.descent- p.ascent)/2 - p.descent