Android : Implementing custom view with buttons
<p>I am creating a custom view which will have a bitmap so that user can draw in it and some normal Android buttons in the bottom for user interaction.</p>

<p>To size my bitmap (height of drawing areas should be 50% ) I am overriding </p>

<pre><code>protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    int parentHeight = MeasureSpec.getSize(heightMeasureSpec);
    this.setMeasuredDimension(widthMeasureSpec, (int)(parentHeight * 0.50));
super.onMeasure(widthMeasureSpec, (int)(parentHeight * 0.50));
} 
</code></pre>

<p>This gives me exception that 
"java.lang.IllegalArgumentException: width and height must be > 0"</p>

<p>If I set super.onMeasure(widthMeasureSpec, heightMeasureSpec);
I cannot see my buttons places in the bottom.</p>

<p>If I dont write super.onMeasure() anything I draw is not seen once I release the mouse.</p>

<p>I am using a xml file for layout :</p>

<pre><code>&lt;view class="com.my.CustomView" android:id="@+id/myView"
    android:layout_width="fill_parent" android:layout_height="wrap_content"/&gt;
&lt;LinearLayout android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:orientation="horizontal"&gt;
    &lt;Button android:layout_height="wrap_content"
        android:text="B1" android:layout_width="wrap_content"/&gt;
    &lt;Button android:layout_height="wrap_content"
        android:layout_width="wrap_content" android:text="B2"/&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>What else should I do ?</p>
