简体   繁体   中英

How to lock screen orientation to landscape

我使用的是横向模式的应用程序,可以通过使用RD服务捕获用户aadhar数据,但是当我将morpho设备连接到选项卡时,“ Morpho SCL-RDService”应用程序可以注册该morpho设备,这可以使我当前的活动变为人像模式,然后是横向模式。因此,有什么方法可以解决由于其他应用程序的干扰而无法更改的方向。在此先感谢。

You need to set android:screenOrientation="landscape " Orientation to your Activity in Manifest file

like this

<activity android:name=".MainActivity"
    android:screenOrientation="landscape">
     <intent-filter>
         <action android:name="android.intent.action.MAIN" />

         <category android:name="android.intent.category.LAUNCHER" />
     </intent-filter>
</activity>

Add this in Manifest.xml file

 <activity android:name=".MainActivity"
        android:screenOrientation="landscape"
        android:configChanges="keyboardHidden|orientation|screenSize‌​"
        >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

只需尝试此setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

您是否添加了活动的景观布局?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM