Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the Width and Height change with orientation?

Tags:

java

android

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?

like image 853
gsfd Avatar asked Oct 08 '11 19:10

gsfd


1 Answers

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.

like image 168
slayton Avatar answered Oct 03 '22 11:10

slayton