Screen height doesn't match actual screen height
<p><strong>Solved:</strong></p>

<p>As Zoltán wrote I didn't take the statusbar and titlebar into consideration (They're both 25 in height)</p>

<p>I used the following code in my onClickListener method inside my Activity and forwarded the results to my Service class and printed it out there:</p>

<pre><code>Rect rectgle = new Rect();
Window window = getWindow();
window.getDecorView().getWindowVisibleDisplayFrame(rectgle);
int StatusBarHeight = rectgle.top;
int contentViewTop = window.findViewById(Window.ID_ANDROID_CONTENT).getTop();
int TitleBarHeight = contentViewTop - StatusBarHeight;

serviceIntent.putExtra("Titlebarheight", Integer.toString(TitleBarHeight));
serviceIntent.putExtra("Statusbarheight", Integer.toString(StatusBarHeight));
</code></pre>

<h2>-----------------------------------------------------------------------------------------</h2>

<p>I am trying to set the layout height of my ImageView in my <strong>main.xml</strong>, but when I set the layout_height to 270dp (or px) it fills up the whole screen from top to bottom, but my screen size is actually 320x240 (HTC magic - Android 1.5) - So it SHOULDN'T fill up the screen from top to bottom!</p>

<p>Code inside Activity:</p>

<pre><code>Display display = getWindowManager().getDefaultDisplay();
Log.i("Screen height", Integer.toString(display.getHeight())); // Returns 320
Log.i("Screen width", Integer.toString(display.getWidth())); // Returns 240
</code></pre>

<p>Code inside main.xml:</p>

<pre><code>&lt;ImageView
    android:id="@+id/bitmapImageView"
    android:layout_height="270dp" // Fills up the whole screen from top to bottom
    android:layout_width="50dp"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:background="#FFFFFF"
    android:src="@drawable/ic_launcher" /&gt;
</code></pre>

<p>Why is this happening? How can I fix it?</p>

<p>Example when using 270 as layout height:</p>

<p><img src="http://i.stack.imgur.com/Ex0PE.png" alt=""></p>

<p>Example when using 240 as layout height:</p>

<p><img src="http://i.stack.imgur.com/px30r.png" alt=""></p>
