如何在React Native Android开发模式下禁用横向模式? [英] How to disable landscape mode in React Native Android dev mode?
问题描述
我是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屋!