Solved:
As Zoltán wrote I didn't take the statusbar and titlebar into consideration (They're both 25 in height)
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:
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));
-----------------------------------------------------------------------------------------
I am trying to set the layout height of my ImageView in my main.xml, 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!
Code inside Activity:
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 inside main.xml:
<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" />
Why is this happening? How can I fix it?
Example when using 270 as layout height:
Example when using 240 as layout height: