I am in trouble with Portrait and Landscape modes of my android application. So, I want to know how to restrict my application in anyone mode only. Thanks in advance to any reply with suitable answer and problem solving solution.
Asked
Active
Viewed 71 times
-1
-
2possible duplicate of [How to disable orientation change in Android?](http://stackoverflow.com/questions/1512045/how-to-disable-orientation-change-in-android) – Abhinav Singh Maurya Jul 21 '15 at 10:35
4 Answers
4
You can define your screen Orientation in your manifest file, activity tag
android:screenOrientation="landscape"
for more detail refer here.
Gunaseelan
- 12,697
- 10
- 74
- 118
2
add the below code in the activity tag of your manifest file...
android:screenOrientation="landscape"
Rishad Appat
- 1,776
- 1
- 13
- 29
1
Add android:screenOrientation to your activity tag in manifest file like below code:
<activity
android:name="com.packagename.YourActivity"
android:screenOrientation="portrait" >
</activity>
Pankaj
- 7,675
- 6
- 40
- 62
-
Thank you, but will this work with both Linear & Relative Layouts ? – John Kiran Jul 21 '15 at 10:41
0
Try this:
<activity
android:name=".MyActivity"
android:configChanges="orientation|keyboardHidden|keyboard"
android:screenOrientation="portrait" />
JonasCz
- 11,660
- 6
- 43
- 64
Chandan Jha
- 21
- 2