title: Get height and width of a layout programmatically
body: <p>I have designed an layout in which <code>LinearLayout</code> has 2 children <code>LinearLayout</code> and <code>FrameLayout</code> and in each child I put different views.</p>
  
  <p>I just wanted to measure height and width of <code>FrameLayout</code> so that I could serve my purpose.</p>
  
  <p>In program I am using </p>
  
  <pre><code>int height,width;
  
  FrameLayout fr=(FrameLayout)findviewbyid(R.id.fr);
  height=fr.getHeight();
  width=fr.getWidth();
  </code></pre>
  
  <p>returns value as <code>0</code> for both  </p>
  
  <p>Even I tried with following code
  int height,width;</p>
  
  <pre><code>FrameLayout fr=(FrameLayout)findviewbyid(R.id.fr);
  height=fr.getMeasuredHeight();
  width=fr.getMeasuredWidth();
  </code></pre>
  
  <p>returns same value <code>0</code></p>
  
  <p>and finally I tried with following code,
  int height,width;</p>
  
  <pre><code>FrameLayout fr=(FrameLayout)findviewbyid(R.id.fr);
  height=fr.getgetLayoutParams().height();
  width=fr.getLayoutParams().width;
  </code></pre>
  
  <p>returns me <code>-2</code> and <code>-1</code></p>
  
  <p>I want the solution to get height and width of any layout programmatically?</p>