-
第一步
measure
view.measure(MeasureSpec.UNSPECIFIED,MeasureSpec.UNSPECIFIED)
-
第二步现在你可以使用宽度
getMeasuredWidth
和高度使用getMeasuredHeight
int width = view.getMeasuredWidth(); int height = view.getMeasuredHeight();
转载于:https://www.cnblogs.com/androidsuperman/p/3829117.html