对cordova的每个平台配置(config.xml) [英] Per platform configuration (config.xml) on cordova

查看:542
本文介绍了对cordova的每个平台配置(config.xml)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

类似 -

<gap:config-file platform="ios" parent="UISupportedInterfaceOrientations" overwrite="true">
   <array>
      <string>UIInterfaceOrientationPortrait</string>
   </array>
</gap:config-file>

like the answer from this question regarding Phonegap.

在config中有一个选项。 xml on Cordova?

is there an option for it in config.xml on Cordova?

推荐答案

对于屏幕方向,添加< preference name =Orientationvalue = portrait/> 会导致CLI在每次构建时在平台特定的配置文件中添加特定的标签(Androidmanifest.xml for Android和对不起我不知道IOS .. 。)

For screen orientation, adding <preference name="Orientation" value="portrait" /> will result in the CLI adding the specific tags in the platform specific config files each time you build (androidmanifest.xml for android and sorry I don't know much about IOS...)

如果你想强制ios而不是android的方向,你可以试试:

If you want to force the orientation for ios but not android, you can try this :

<platform name="ios">
        <preference name="Orientation" value="portrait" />
</platform>

对于其他选项,有一些标签只能被一些平台识别,所以你将它们添加到配置。 xml和cli使用它或不根据平台。请参见此处的android-only选项和< a href =http://cordova.apache.org/docs/en/edge/guide_platforms_ios_config.md.html#iOS%20Configuration =nofollow>此处仅适用于ios专用选项。

For other options, there are tags that are recognised only by some platforms so you add them to config.xml and the cli uses it or not depending on the platform. See here fore android-only options and here for ios-only options.

对于插件这样的事情,你使用cli来定制每个平台,但不要触摸config.xml。

For things like plugins, you use the cli to customize each platform, but don't touch config.xml.

对于其他事情,不幸的是,一旦平台被添加到项目,你可能需要手动编辑特定的平台配置文件(即androidmanifest.xml)。当您构建项目时,这些选项应该保存在配置文件中。

For other things unfortunatly you may have to manually edit the specific platform config file (ie androidmanifest.xml) once the platform has been added to the project. When you build the project, those options should be kept in the config file.

这篇关于对cordova的每个平台配置(config.xml)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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