首页 > 代码库 > View通用

View通用

1、计算view尺寸

ViewTreeObserver vto = view.getViewTreeObserver();vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {        public boolean onPreDraw() {                int height = view.getMeasuredHeight();                int width = view.getMeasuredWidth();                return true;            }}); 

 

View通用