Log.d("TAG", String.format("%d, %d", view.getMeasuredWidth(), view.getMeasuredHeight()));
view.measure(0, 0);
Log.d("TAG", String.format("%d, %d", view.getMeasuredWidth(), view.getMeasuredHeight()));
输出结果:
0, 0
xx, xx
Log.d("TAG", String.format("%d, %d", view.getMeasuredWidth(), view.getMeasuredHeight()));
view.measure(0, 0);
Log.d("TAG", String.format("%d, %d", view.getMeasuredWidth(), view.getMeasuredHeight()));