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?
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
Click that button next to "Nexus 5".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With