0
我有以下佈局定義:入門的佈局尺寸的Android
<LinearLayout>
<TextView />
<RelativeLayout>
<TextView>
<Button>
<Button>
</RelativeLayout>
<LinearLayout>
現在我想要得到的RelativeLayout的高度(我希望通過編程指定其子女的身高):
View rel = findViewById(R.id.RelativeLayout01);
int width = rel.getWidth();
int height = rel.getHeight();
但是size returned is 0
。我如何獲得的RelativeLayout的大小(它主要是僞以上,但兩者的佈局必須在XML「FILL_PARENT」的高度/寬度)