我正在尝试让我的 ionic/Cordova 应用程序不支持小屏幕。所以我在项目文件夹根目录下的 config.xml 中有这个:
<config-file parent="/" target="AndroidManifest.xml">
<supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="false" />
</config-file>
尽管在\platform\android\res\xml\中生成的config.xml 具有以下内容:<config-file parent="/" target="AndroidManifest.xml">
<supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="false" />
</config-file>
,输出 AndroidManifest.xml 显示 <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true"/>
.
所以基本上,我的屏幕相关配置被忽略了,它只执行默认设置。
如何真正关闭小屏幕支持?
最佳答案
确保你已经安装了 cordova-custom-config 插件 (cordova plugin add cordova-custom-config)
确保您已经添加了 Android 命名空间属性
来自文档:为了在您的 config.xml 中的首选项中使用 android: 命名空间,您必须在根目录中包含 android 命名空间属性
<widget>
元素。命名空间属性 fragment 是:xmlns:android="http://schemas.android.com/apk/res/android"
确保你已经定义了
<config-file target="AndroidManifest.xml" parent="/*">
android平台元素(<platform name="android">
)内的元素,否则将被忽略。
关于android - 在 Android 中为 ionic/Cordova 应用程序设置支持屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30668889/