gavin
gavin

Reputation: 325

Screen orientation in editor in Android Studio

In android studio, when run, my program is displayed in landscape mode and works perfectly well. However, when viewing the xml design, the virtual device is displayed in portrait mode. How do I display the xml in landscape mode?

Upvotes: 4

Views: 35669

Answers (2)

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75788

Short Cut

Ctrl+F11 Switch layout orientation portrait/landscape backwards [AVD]

The screenOrientation is the attribute of activity element. The orientation of android activity can be portrait, landscape, sensor, unspecified etc. You need to define it in the AndroidManifest.xml file.

You can add

  android:screenOrientation="landscape"

Your screen will always display in Landscape mode, when you rotate your device, no changes will apply for the current activity.

Like

 <activity
        android:name=".ActivityName"
        android:label="@string/app_name"
        android:screenOrientation="landscape" />

Please check official Guideline:
https://developer.android.com/guide/topics/manifest/activity-element.html#screen

Upvotes: 5

Jagoan Neon
Jagoan Neon

Reputation: 1128

Click that button next to "Nexus 5".

enter image description here

Upvotes: 3

Related Questions