2013-03-12 61 views

回答

7

使用此代码,给

Rect bounds = new Rect(); Paint textPaint = textView.getPaint(); 
textPaint.getTextBounds(text,0,text.length(),bounds); 
int height = bounds.height(); 
int width = bounds.width(); 

标题有误导之嫌。一个android开发人员不一定会想到windows方法GetTextExtentPoint()。请编辑它。

+0

完美。 – Ganesh 2014-04-10 12:39:47