7

So my game starts in Vertical orientation and then eventually goes to Horizontal orientation. I know that the width of the screen is the width of the screen and the same with height when it is in Vertical orientation. When it switches to Horizontal orientation does the Height become the Width and the Width becomes the Height? Or do they stay the same?

billinkc
  • 59,250
  • 9
  • 102
  • 159
gsfd
  • 1,070
  • 2
  • 12
  • 17

2 Answers2

4

Yes the screen width and height change depending on the device orientation. You can get the size of a display with Display.getSize(Point outSize) which is a replacement for the deprecated methods Display.getHeight and Display.getWidth. From the docs: This value is adjusted for you based on the current rotation of the display.

slayton
  • 20,123
  • 10
  • 60
  • 89
  • Thanks, thats what i thought, i was having some issues with an activity drawing a drawable but it turns out i had a variable out of place. – gsfd Oct 08 '11 at 19:53
0

wanted to add that on my tablet when running full screen apps it will run 1280 x 753 (not 800 because of the bottom bar). 753 is what is returned from getSize. When the orientation flips.. it's 1280px - 47px

DJPlayer
  • 3,244
  • 2
  • 33
  • 40