如何仅在所有平台的离子中限制应用程序到纵向模式 [英] how to restrict app to portrait mode only in ionic for all platform

查看:88
本文介绍了如何仅在所有平台的离子中限制应用程序到纵向模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究Ionic / Cordova,我将其添加到 androidManifest.xml 但是这对我不起作用且应用程序仍以两种方式显示

I'm working on Ionic/Cordova, I added this to androidManifest.xml but this didn't work for me and app is still showing in both ways

android:screenOrientation="portrait"

如何才能将我的应用限制为仅限肖像模式?我已经检查了android并且它无法正常工作

how can I restrict my app to portrait mode only? I have checked on android and it doesn't work

推荐答案

如果你想仅在所有设备上限制为纵向模式你应该将此行添加到项目根文件夹中的config.xml。

If you want to restrict to portrait mode only on all devices you should add this line to the config.xml in your projects root folder.

<preference name="orientation" value="portrait" />

之后,请在命令行中输入以下文字重建平台:

After that, please rebuild the platform by typing below text in command line:

ionic build

这篇关于如何仅在所有平台的离子中限制应用程序到纵向模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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