在Android中为ionic / Cordova应用程序设置支持屏幕 [英] Setting supports-screens for ionic/ Cordova app in Android

查看:191
本文介绍了在Android中为ionic / Cordova应用程序设置支持屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力让我的离子/ Cordova应用程序不支持小屏幕。所以我在项目文件夹根目录下的config.xml中有以下内容:

I am trying to make my ionic/ Cordova app to not support small screens. So I have this below inside my config.xml at the root of the project folder :

<config-file parent="/" target="AndroidManifest.xml">
    <supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="false" />
</config-file>

尽管在\ platform \ android \\\ xml \中生成了config.xml具有以下内容:< config-file parent =/target =AndroidManifest.xml>
< supports-screens android:largeScreens =trueandroid:normalScreens =trueandroid:smallScreens =false/>
< / config-file>

Although the config.xml generated inside \platform\android\res\xml\ has the below content fine:<config-file parent="/" target="AndroidManifest.xml"> <supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="false" /> </config-file>

,输出AndroidManifest.xml显示< supports-屏幕android:anyDensity =trueandroid:largeScreens =trueandroid:normalScreens =trueandroid:resizeable =trueandroid:smallScreens =trueandroid:xlargeScreens =true/>

, the output AndroidManifest.xml shows <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true"/>.

所以基本上,我的屏幕相关配置被忽略,它只做默认值。

So basically, my screen related config is ignored, it only do the default.

我如何实际关闭小屏幕支持?

How do I actually turn off small screen support?

推荐答案


  1. 确保已安装cordova-custom -config插件(cordova插件添加cordova-custom-config)

  1. Make sure you have installed the cordova-custom-config plugin (cordova plugin add cordova-custom-config)

确保添加了Android命名空间属性

Make sure you have added the Android namespace attribute

从文档中:为了在config.xml中的首选项中使用android:namespace,您必须在根< widget> 元素。命名空间属性片段是:

From the documentation : In order to user the android: namespace in preferences within your config.xml, you must include the android namespace attribute on the root <widget> element. The namespace attribute fragment is:

 xmlns:android="http://schemas.android.com/apk/res/android"


  • 确保已定义< config-file target =AndroidManifest.xmlparent =/ *> android平台元素内的元素(< platform name =android> ),否则将被忽略。

  • Make sure you have defined <config-file target="AndroidManifest.xml" parent="/*"> element inside the android platform element (<platform name="android">), otherwise it will be ignored.

    来源: https://www.npmjs.com/package/cordova-custom-config

    这篇关于在Android中为ionic / Cordova应用程序设置支持屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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