title: Getting the size of an layout in Android
body: <p>I have the following layout defined:</p>
  
  <pre><code>&lt;LinearLayout&gt;
    &lt;TextView /&gt;
    &lt;RelativeLayout&gt;
       &lt;TextView&gt;
       &lt;Button&gt;
       &lt;Button&gt;
    &lt;/RelativeLayout&gt;
  &lt;LinearLayout&gt;
  </code></pre>
  
  <p>now i want to get the height of the RelativeLayout (i want to specify the height of its children programatically):</p>
  
  <pre><code>View rel = findViewById(R.id.RelativeLayout01);
  int width = rel.getWidth();
  int height = rel.getHeight();
  </code></pre>
  
  <p>but the <code>size returned is 0</code>. How do I get the size of the RelativeLayout (it's mostly pseudocode above, but both layout have a height/width of "fill_parent" in the xml)</p>