如何在React Native Android开发模式下禁用横向模式? [英] How to disable landscape mode in React Native Android dev mode?

查看:147
本文介绍了如何在React Native Android开发模式下禁用横向模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是android环境的新手.我知道iOS可以在Xcode中完成以禁用设备方向.如何在React Native Android中禁用横向模式或任何方向模式?

I am new to android environment. I know iOS can be done in Xcode to disable device orientation. How can I disable landscape mode or any orientation mode in React Native Android?

谢谢.

推荐答案

android/app中的 activity 部分添加 android:screenOrientation ="portrait" /src/main/AndroidManifest.xml 文件,因此最终看起来像这样:

Add android:screenOrientation="portrait" to the activity section in android/app/src/main/AndroidManifest.xml file, so that it end up looking like this:

<activity
    android:name=".Activity"
    android:label="Activity"
    android:screenOrientation="portrait"
    android:configChanges="keyboardHidden|orientation|screenSize">
</activity>

android:screenOrientation 属性有多个不同的值;要获得完整的列表,请查看以下内容: https://developer.android.com/guide/topics/manifest/activity-element.html

There are several different values for the android:screenOrientation property; for a comprehensive list take a look at the following: https://developer.android.com/guide/topics/manifest/activity-element.html

这篇关于如何在React Native Android开发模式下禁用横向模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆