今天用getLineCount()方法获取行高失败;
原因:
public int getLineCount ()
Since: API Level 1
Return the number of lines of text, or returns 0 if the internal Layout has not been built.
解决办法:
tv.setText("Text Here");
tv.post(new Runnable() {
@Override
public void run() {
int lineCount = tv.getLineCount();
Log.v("LINE_NUMBERS", lineCount+"");
}
});