Just a general question here. I've read that it is not possible to lock orientation to portrait or landscape in a relative layout. I developed the app already so I don't want to change my layout and have to delete everything in my layout and start over, but if I have to I will. So is there anyway to workaround this like turn auto rotate off on the device the app is installed? Please don't go research and waste your time to find a workaround because it isn't a necessity. So once again thanks for reading and any help is greatly appreciated. Bye!
Asked
Active
Viewed 1,157 times
0
-
I'm not sure I get the question right, but there's no connection between the type of layout you use and a device's orientation. Screen orientation is kind of a higher level thing, activity or application specific. For sure you can [lock](http://stackoverflow.com/a/1512263/4096987) the orientation for any type of layout or no layout at all. Please correct me if you question was about something different. – AndroidEx Apr 04 '15 at 01:30
-
Usually in android studio in the xml if I use a linear layout I can define android:orientation:portrait but in a relative layout I am unable to. – Igor Kronkdev Apr 04 '15 at 01:32
-
Do you specify it in `
` tag? `android:orientation` is meant to be `horizontal` or `vertical`, I don't know why it works in your case, probably gets ignored. Anyway it does not lock the orientation, but defines how LinearLayout layouts its children, in columns or rows respectively. How to lock the screen orientation you can look up in the link I gave above. – AndroidEx Apr 04 '15 at 01:38
1 Answers
2
You can define orinetation in AndroidManifest.xml
<activity android:name=".NameOfTheActivity"
android:screenOrientation="portrait"/>

Yauraw Gadav
- 1,706
- 1
- 18
- 39