如何在所有平台的 ionic 中将应用程序限制为纵向模式? [英] How to restrict app to portrait mode only in ionic for all platforms?

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

问题描述

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

android:screenOrientation="portrait"

如何将我的应用限制为仅纵向模式?我已经在 android 上检查过,但它不起作用

解决方案

如果您想仅在所有设备上限制为纵向模式,则应将此行添加到项目根文件夹中的 config.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"

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

解决方案

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

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

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