简体   繁体   English

如何在 android 清单文件中设置纵向和横向

[英]How to set the Portrait and landscape orientation in android manifest file

Portrait mode is working and landscape is not showing.纵向模式正在运行,横向未显示。

android:screenOrientation="portrait" // Here i need to show both portrait and landscape. android:screenOrientation="portrait" // 这里我需要显示纵向和横向。

You can use:您可以使用:

android:screenOrientation="unspecified"

This is the default value and the system chooses the orientation.这是默认值,系统会选择方向。

alternatively, you can use:或者,您可以使用:

android:screenOrientation="fullSensor"

In this case, device orientation sensor determinates the screen orientation.在这种情况下,设备方向传感器确定屏幕方向。

Try one and the other to see which one works best for you.尝试其中一种,看看哪一种最适合您。

EDIT: For a specific class, you can do this:编辑:对于特定的 class,您可以这样做:

<activity
            android:name=".YOUR_CLASS"
            android:screenOrientation="unspecified"  // or what you want
            android:theme="@style/Theme.Design.NoActionBar"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将平板电脑清单中的方向设置为手机的横向和纵向? - How to set up orientation in manifest for tablets as landscape and portrait for phones? 如何将MediaRecorder方向设置为横向或纵向 - How to set MediaRecorder orientation to landscape or portrait 在纵向方向机器人的风景布局 - Landscape layout in portrait orientation android 尽管清单文件中设置了肖像,但HTC Chacha显示风景 - HTC Chacha showing landscape although portrait is set in the manifest file 纵向和横向方向,并在片段中设置android:configChanges =“ orientation” - portrait and landscape orientations and set android:configChanges=“orientation” in fragment 如何通过更改方向的黑白风景和肖像在android中播放视频? - How to play video in android by changing orientation b/w landscape and portrait? 如何检测Android设备是纵向还是横向锁定 - How to detect whether Android device is locked in portrait or landscape orientation 如何在 Android Print Framework 中将默认的“纵向”更改为横向? - How to change the default “Portrait Orientation” to Landscape in Android Print Framework? 如何锁定 Android 应用程序在手机中的纵向和平板电脑中的横向? - How to Lock Android App's Orientation to Portrait in Phones and Landscape in Tablets? 如何在Android的firebase UI中将方向设置为纵向 - How to set the orientation to portrait in firebase UI in Android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM