如何忽略科尔多瓦应用程序在Android 4.4或以上版本运行时字体大小设置更改? [英] How to ignore font-size setting changes for Cordova App when runs on Android 4.4+?

查看:164
本文介绍了如何忽略科尔多瓦应用程序在Android 4.4或以上版本运行时字体大小设置更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发应用科尔多瓦与科尔多瓦3.6.3版本和JQuery。唯一的一个问题,我仍然不能得到最佳的解决方案是,当我在Android上测试我的应用程序4.4+和有爱谁在设置,更改字体大小的用户>其设备的显示>字体大小要大于正常。它使我的应用程序布局显示丑(最佳显示时字体大小设置为正常专用)。但字体大小设置为Android上的旧版本没有影响早于4.4(4.3,4.2)。所以应用显示完美。

I've developed Cordova App with Cordova Version 3.6.3 and JQuery. The only one problem that i still can't get the best solutions is when i test my app on Android 4.4+ and there are users who love to change font size in setting > display > font-size of their device to be larger than normal. It causes my app layout displays ugly (the best display is when the font-size setting is normal only). But there is no effect of font-size setting for Android older than 4.4 (4.3,4.2...) So the app displays perfectly on older version.

这是我已经应用到我的应用程序的解决方案是创建自定义的插件检测配置改变,如果用户使用的Andr​​oid 4.4+它会检测到,如果他们设置字体大小设置任何不正常,我会使用jQuery强制字体大小设置为指定大小。

The solutions that I've applied to my app is creating the custom plugin to detect configuration changed and it will detects if user uses Android 4.4+ and if they set font-size setting to anything that is not normal, I'll use JQuery to force font-size to the specified size.

示例是....

if (font_scale == huge)
{
    $("div").css("font-size","20px !important");
}

这工作得很好,但有时加载页面后,因为我想在CSS不改​​变。而想,如果有30个的div +在该网页上,所以我必须插入像上面30倍的说法,它需要太多的时间不必要。

This works fine but sometimes after the page loaded, the css doesn't changes as I want. And suppose if there are 30 divs+ on that page so i must insert the statement like above 30 times and it takes too much time needlessly.

我只是想知道,有没有解决这个问题比使用这个插件另一个更简单的方式?也许使用一些XML配置或CSS3属性,可以让我的应用程序正确地显示未经Android 4.4系统的字体大小设置副作用?

I just want to know, are there another ways to solve this problem that is easier than using this plugin? Maybe using some XML configuration or CSS3 properties that can makes my app displays properly without side effect from font-size setting of Android 4.4?

另一个方法我也试过,它没有作品

Another ways I also tried and it doesn't works are


  1. 在AndroidManifest.xml中插入fontScale>活动标记

  2. 插入WebKit的文字大小调整:无;在CSS

我很想听到有助于解决这个任何想法。

I'd love to hear any ideas that help to solve this.

推荐答案

尝试从您的index.html删除它:

Try to remove this one from your index.html:

目标densitydpi =设备DPI

祝你好运。

这篇关于如何忽略科尔多瓦应用程序在Android 4.4或以上版本运行时字体大小设置更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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