-
第一步
measure
view.measure(MeasureSpec.UNSPECIFIED,MeasureSpec.UNSPECIFIED)
-
第二步现在你可以使用宽度
getMeasuredWidth
和高度使用getMeasuredHeight
int width = view.getMeasuredWidth(); int height = view.getMeasuredHeight();
第一步measure
view.measure(MeasureSpec.UNSPECIFIED,MeasureSpec.UNSPECIFIED)
第二步现在你可以使用宽度getMeasuredWidth
和高度使用getMeasuredHeight
int width = view.getMeasuredWidth(); int height = view.getMeasuredHeight();