安卓Textview的getLineCount返回0

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  ,如需转载请自行联系原作者

上一篇:Photoshop将外景人物打造出唯美的古典淡绿色


下一篇:Elastic:机器学习的实践 - single metric job