Fullscreen App, Layout shifted down by height of notification bar
<p>I have an App that has a toolbar at the bottom of the screen and the rest is filled with a custom View (see xml below). Now when I make the App full screen (I tried all possibilities, programmatically and via Manifest.xml), when it's started the whole layout seems to be shifted down by about the height of the notification bar. The buttons in the toolbar are only visible half-way. Sometimes, all of it moves up after a few seconds, or when I click a button in the toolbar.</p>

<p><img src="http://i.stack.imgur.com/qAhMj.png" alt="enter image description here"></p>

<p>I'm pretty sure, that it's a problem with my custom view, because I do not get this effect if I replace it with a Button or the like. I guess it must have something to do with the <code>onMeasure</code> method. I don't really know how to implement it, my version is shown below. The custom view is used for drawing inside, so basically it wants to be as large as possible.</p>

<p>Any help would be much appreciated. I searched for several hours already, but no clue yet.</p>

<p><strong>layout.xml</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:orientation="vertical"&gt;
    &lt;com.example.MyCanvasView 
        android:id="@+id/canvas" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:layout_weight="1" 
         /&gt;
    &lt;!-- Buttonbar --&gt;
    &lt;LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:paddingTop="4dp"
        android:orientation="horizontal"
        android:background="@android:drawable/bottom_bar"
        &gt;
        &lt;Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="1"
        /&gt;
        &lt;Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="2"
        /&gt;
        &lt;Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="3"
        /&gt;
    &lt;/LinearLayout&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>And this is my <code>onMeasure</code> method:</p>

<pre><code>protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    int width = MeasureSpec.getSize(widthMeasureSpec);
    int height = MeasureSpec.getSize(heightMeasureSpec);
    setMeasuredDimension(width, height);
}
</code></pre>
