final Rect bounds = new Rect();
final Paint paint = new Paint();
paint.setTextSize(currentTextSize);
paint.getTextBounds(testString, 0, testString.length(), bounds);
现在,将文本的宽度除以TextView的宽度即可得到总行数。
final int numLines = (int) Math.ceil((float) bounds.width() / currentSize);



