android View未渲染时获得高度

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

 

你可能感兴趣的:(android View未渲染时获得高度)