-2

I would like to keep the screen in a portrait position and not allowed screen rotation in my app. How should I do that ?

Galaxy
  • 3
  • 3

1 Answers1

2

I can recall two ways, either try putting a ScreenOrientation in your manifest :

android:screenOrientation="portrait" // OR "landscape"

Or just do the following in code :

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // ORActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
Mekap
  • 2,065
  • 14
  • 26