0

How to set application in port mode only? I does not wanna when phone landscape is on my application should still work in port mode dose not change to land mode.

Hitesh Matnani
  • 533
  • 2
  • 8
  • 26

4 Answers4

1

You can use this in your manifest file for your Activity to restrict the application to Portrait mode:

<activity
    android:name="com.package.MainActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
</activity>

Hope it helps.

MysticMagicϡ
  • 28,593
  • 16
  • 73
  • 124
0

You do it in the MANIFEST file, where you declare your Activity.

Set the screenOrientation property to portrait, like this:

    <activity
        android:name=".MyActivity"
        android:screenOrientation="portrait" >
    </activity>
Richard Le Mesurier
  • 29,432
  • 22
  • 140
  • 255
0

You can set your application mode using AndroidManifest.xml:

<activity android:name=".YourActivity"
android:configChanges="orientation"
android:screenOrientation="portrait"/>

Or you can do it programatically:

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
MSA
  • 2,502
  • 2
  • 22
  • 35
0

Add the following code in your APP MANIFEST file,

Set screenOrientation property to portrait,:

    <activity
        android:name=".MainActivity"
        android:screenOrientation="portrait" >
    </activity>
Sagar Pilkhwal
  • 3,998
  • 2
  • 25
  • 77