Android layouts for custom views
<p>I'm trying to create a window with a custom view at the top, and three buttons at the bottom. I would like the view to take up the real estate which is left over after the buttons have been created. My layout XML is as follows</p>

<pre><code>&lt;LinearLayout   xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="#ffffff" &gt;
  &lt;FrameLayout
    android:id="@+id/CustomFrame"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" /&gt;
  &lt;LinearLayout
      android:orientation="horizontal"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:background="#ffffff" &gt;
    &lt;Button
        android:id="@+id/Button01"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/ok"
        android:layout_marginBottom="10dip" 
        android:layout_marginTop="10dip"  /&gt;
    &lt;Button
        android:id="@+id/Button02"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/cancel"
        android:layout_marginBottom="10dip" 
        android:layout_marginTop="10dip"  /&gt;
    &lt;Button
        android:id="@+id/Button03"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/clear"
        android:layout_marginBottom="10dip" 
        android:layout_marginTop="10dip"  /&gt;
  &lt;/LinearLayout&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>I then add my custom view to the window with the code</p>

<pre><code>  setContentView(R.layout.drawitwindow);
  FrameLayout layout = (FrameLayout)findViewById(R.id.CustomFrame);
  mView = new MyCustomView(this);
  layout.addView(mView);
</code></pre>

<p>in the onCreate method.</p>

<p>However, the custom view takes up the whole screen! If I remove the code which adds the custom view to the frame, the button bar appears at the top of the window (as I would expect).</p>

<p>I've tried overriding the onMeasure method, adding</p>

<pre><code>     super.onMeasure(widthMeasureSpec, heightMeasureSpec);

     int parentWidth = MeasureSpec.getSize(widthMeasureSpec);
     int parentHeight = MeasureSpec.getSize(heightMeasureSpec);
     this.setMeasuredDimension(parentWidth,parentHeight);
</code></pre>

<p>but this doesn't make any difference.</p>

<p>I've tried various combinations of layout width and height, and again that doesn't seem to make any difference.</p>

<p>All help will be very gratefully received...</p>
