android View未渲染时获得高度

ViewTreeObserver vto = tv.getViewTreeObserver();
            vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
                public void onGlobalLayout() {
                    
                    heigh = appDescription.getHeight();
                    
                    tv.getViewTreeObserver().removeGlobalOnLayoutListener(this);
                }
            });

 

posted @ 2015-11-02 15:53  netcorner  阅读(505)  评论(0编辑  收藏  举报