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.
Asked
Active
Viewed 207 times
4 Answers
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,305
- 16
- 71
- 119
-
thnxs! ones again :) – Hitesh Matnani Sep 29 '14 at 07:35
-
yha sure i will accept it but i cant accept it before 8 mints as stackoverflow does not give me permission to do that :P – Hitesh Matnani Sep 29 '14 at 07:40
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
- 28,920
- 20
- 132
- 247
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,494
- 1
- 21
- 34
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
- 5,914
- 2
- 27
- 78