Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android, landscape only orientation?

Tags:

android

How can I make it so the screen orientation is always landscape?

Do I need to add something to the manifest.xml?

like image 776
panthro Avatar asked Dec 06 '11 23:12

panthro


People also ask

How do I force orientation on Android?

Use Rotation Control to force screen orientation of Android devices. Once you've installed, open the app and just tap to turn it on. You can even start it when you restart your phone. This will help you when you don't want to open the again and again after every reboot.

How do I change the default landscape in Android Studio?

Step 1: Open the base UI layout in DESIGN mode so that you see the actual GUI, such as Buttons, icons, etc. Step 2: Click the icon marked in the below screenshot and, from the menu, select Create Landscape Variation. Then the corresponding Landscape file will be created automatically named as land\xml file name.


1 Answers

Add this android:screenOrientation="landscape" to your <activity> tag in the manifest for the specific activity that you want to be in landscape.

Edit:

To toggle the orientation from the Activity code, call setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) other parameters can be found in the Android docs for ActivityInfo.

like image 199
DRiFTy Avatar answered Sep 23 '22 11:09

DRiFTy