java - Screen height doesn't match actual screen height -


Resolve:

As Zoltan wrote, I did not take the statusbar And keeping the title bar in mind (both of them in height 25)

I used the following code inside my activity in my on-Clclestoner method and sent the results to my service class and it was there Printed: Rect Rict.org = New Rect (); Window window = getWindow (); . Window.getDecorView () getWindowVisibleDisplayFrame (rectgle); Int statsbrown = rectgle.top; Int contentViewTop = window.findViewById (window .ID_ANDROID_CONTENT) .getTop (); Int titleBarHight = ContentViews - StatusEverything; ServiceIntent.putExtra ("titlebarHeight", integer .tosting (titlebarHeight); ServiceIntent.putExtra ("Position Checkpoint", Integer. Stosting (Statusbright));

--------------------------------------- --------------------------------------------------

I'm trying to set the layout height of my imageView in my main.xml , but when I fill the whole screen with (or pixels) to install 270dp layout_height Above top, but my screen size is actually 320x240 (HTC Magic - Android 1.5) - so the screen should not be filled from top to bottom!

Code inside activity:

  display display = getWindowManager (). GetDefaultDisplay (); Logs. I ("Screen Height", Integer Toother (display.metit ()); // Returns 320 log I ("screen width", integer.Tooth (display.getWidth ()); // return 240   

inside the code main.xml:

  & lt; The imageView android: id = "@ + id / bitmapImageView" Android: layout_height = "50dp" Android: layout_alignParentLeft = "true" Android: layout_alignParentTop = "true" android: background = "# FFFFFF: 270dp" layout_width = // under Android Fills the entire screen from above for "Android": src = "@ drawable / IC_Luncher" />   

Why is this happening? How can I fix this?

Example when the layout uses 270 as the height:

the situation is the height of the bar and think about the title bar of your application your imageView That is, 50px as the width of recognizing your XML.

Then 50px + 270px = 320px, which is the total height of your screen (and title bar) with the status.

Comments