我在线性布局中使用了layout weights来设置TextViews。
linearLayout.setWeightSum(7f);
for(int i=0;i<7;i++){
TextView tv= new TextView(this);
tv.setLayoutParams(new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, 0, 1f));
tv.setText("sometext");
linearLayout.addView(tv);
}
当布局绘制完成后,我如何获取这些TextView的宽度和高度?
tv.getWidth() 和 tv.getHeight() 返回0;