锁定设备方向-React Native(Android) [英] Lock device orientation - React Native (Android)

查看:248
本文介绍了锁定设备方向-React Native(Android)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用React Native 0.29并为Android开发.我正在尝试锁定设备方向.我需要将屏幕锁定为纵向模式.我尝试使用此存储库 https://github.com/yamill/react-native-orientation,但尚不支持RN 0.29.

I'm using React Native 0.29 and developing for Android. I'm trying to lock the device orientation. What I need is to lock the screen in portrait mode. I tried with this repository https://github.com/yamill/react-native-orientation but it is not supporting RN 0.29 yet.

有什么方法可以锁定设备方向?也许有任何使用Android Studio的原生Android hack?

Is there any way I can lock the device orientation? Maybe any native Android hack with android studio?

推荐答案

只需将android:screenOrientation ="portrait"添加到AndroidManifest.xml中的活动中即可.

Just add android:screenOrientation="portrait" to the activity in the AndroidManifest.xml.

这篇关于锁定设备方向-React Native(Android)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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