css - Phonegap + Galaxy s3 尺寸

标签 css cordova height galaxy font-size

我将我的第一个应用程序发布到“play store”并且是用 PhoneGap 制作的。

该应用程序在所有设备上看起来都不错,但在 Galaxy S3 和 Note II 中字体大小和 div 高度太大。

我有:

if (window.devicePixelRatio == 1.5) {
          document.write('<link rel="stylesheet" type="text/css" href="css/hdpi.css">');
        } else if (window.devicePixelRatio == 1) {
          document.write('<link rel="stylesheet" type="text/css" href="css/mdpi.css">');
        } else if (window.devicePixelRatio == 2) {
          document.write('<link rel="stylesheet" type="text/css" href="css/xhdpi.css">');
        } else if (window.devicePixelRatio == 0.75) {
          document.write('<link rel="stylesheet" type="text/css" href="css/ldpi.css">');
        }

加载正确的样式表。

银河 S3:

http://img17.imageshack.us/img17/7998/16761073.png

连结 4:

http://img802.imageshack.us/img802/2327/88668575.png

两个设备都是 720x1280。

最佳答案

Imo,最佳做法是在 css 中使用媒体查询来检测大屏幕。

通过媒体查询,您可以检测屏幕尺寸并对您的 css 进行适当的调整。

您可以通过执行 font-size : 100% 将字体大小重置为设备的默认字体大小

关于css - Phonegap + Galaxy s3 尺寸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15899211/

相关文章:

css - 文本的行高,最少 2 行文本

html - iOS Chrome 计算出错误的文档高度

html - 为什么文本对齐属性会减慢文本动画?

android - Cordova 和proguard : Camera Plugin NPE on takePicture

javascript - Android 上的 PhoneGap 选择框行为不当

html - 内容溢出 : auto height to tall for header div

css - 在 CSS Grid 中将列宽设置为内容宽度

CSS3 媒体查询

css - JQuerymobile 图标位置错误

css - 自动调整不同行 Div 的大小