get the size of relative layout declared in xml
<p>This is my xml:</p>

<pre><code> &lt;RelativeLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical"
 android:layout_width="match_parent"
 android:layout_height="match_parent"&gt;

&lt;RelativeLayout 
android:layout_height="fill_parent" 
android:layout_width="fill_parent"
&gt;

    &lt;RelativeLayout 
    android:layout_height="wrap_content" 
    android:layout_width="fill_parent" 
    android:id="@+id/header"
    android:background="@android:color/white"
    &gt;
        &lt;Button 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content"
        android:id="@+id/btnBack"
        android:text="Back"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:layout_marginLeft="5dp"
        /&gt;

        &lt;ImageView 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content"
        android:src="@drawable/icon"
        android:layout_centerInParent="true"
        /&gt;

    &lt;/RelativeLayout&gt;

    &lt;RelativeLayout 
        android:layout_below="@+id/@+id/header"
        android:layout_height="fill_parent" 
        android:layout_width="fill_parent" 
        android:id="@+id/view" 
        android:layout_above="@+id/footer"
     &gt;
     &lt;/RelativeLayout&gt;

     &lt;RelativeLayout
     android:id="@+id/footer" 
     android:layout_height="wrap_content" 
     android:layout_width="fill_parent"
     android:layout_alignParentBottom="true"    
     android:background="@android:color/white"     
     &gt;
        &lt;Button 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content"
        android:id="@+id/btn1"   
        android:text="btn1"
        android:layout_alignParentLeft="true"

        /&gt;

        &lt;Button 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content"
        android:id="@+id/btn2"   
        android:text="btn2"
        android:layout_centerHorizontal="true"
        /&gt;

        &lt;Button 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content"
        android:id="@+id/btn3"   
        android:text="btn3"
        android:layout_alignParentRight="true"
        /&gt;

     &lt;/RelativeLayout&gt;

   &lt;/RelativeLayout&gt;
 &lt;/RelativeLayout&gt;
</code></pre>

<p>the relative layout view is in between the two layouts.
I want to get the size of this relative layout(i.e height and width) in my code.I tried it by using getWidth and getHeight but it is showing 0.
Is there any other way?</p>
