1
2
3
4
5
6
7
8
9
10
11
12
|
ViewTreeObserver observer = tv.getViewTreeObserver(); // textAbstract为TextView控件
observer.addOnGlobalLayoutListener( new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
ViewTreeObserver obs = tv.getViewTreeObserver();
obs.removeGlobalOnLayoutListener( this );
if (tv.getLineCount() >= 2) {
System. out .println( "行数" + tv.getLineCount());
}
}
});
|
本文转自 netcorner 博客园博客,原文链接: http://www.cnblogs.com/netcorner/p/6336499.html ,如需转载请自行联系原作者