How do you create an app that only allows horizontal orientation?

KieH22 picture KieH22 · Nov 20, 2010 · Viewed 14.3k times · Source

I'm currently creating a side-scroller style game for my final year project for my degree.

I'm just wondering how you make the menu designed for when the phone is in horizontal orientation display, even when the phone is held in it's vertical orientation?

i.e. I want the user to know that the game has to be played with the phone in it's horizontal orientation and want the menu's to only display in the horizontal orientation.

Many thanks in advance.

Answer

MatrixFrog picture MatrixFrog · Nov 20, 2010

Add the following attribute to your activity in your AndroidManifest.xml:

android:screenOrientation="landscape"