简体   繁体   English

媒体查询Android默认的“互联网”浏览器吗?

[英]Media queries for android default “internet” browser?

I have a Samsung Galaxy S3 Android Version 2.3 and am trying to change some media queries for it. 我有一个Samsung Galaxy S3 Android 2.3版,正在尝试更改一些媒体查询。 I am using this: 我正在使用这个:
@media only screen and (-webkit-device-pixel-ratio: 2) {} @media only屏幕和(-webkit-device-pixel-ratio:2){}

Which seems to be working for Chrome on Android, but not the native Android Browser. 这似乎适用于Android上的Chrome,但不适用于本机Android浏览器。 I've looked at what would target this browser and it says 360px W, 567px H, -webkit-pixel-ratio:2, but it is not working. 我已经看过了将以该浏览器为目标的内容,它显示了360px W,567px H,-webkit-pixel-ratio:2,但无法正常工作。 Does anyone know how to get this browser to behave? 有谁知道如何使该浏览器运行?

Try setting the pixel ratio to 1.5. 尝试将像素比率设置为1.5。 I haven't actually tested this, however, it looks like the density may actually be 1.5 for hdpi devices (hdpi is 240dpi so it has a 1.5 pixel density over mdli, the baseline, which is 160dpi). 我还没有实际测试过,但是看起来hdpi设备的密度实际上可能是1.5(hdpi是240dpi,所以它在mdli(基线是160dpi)上具有1.5像素密度)。

@media only screen and (-webkit-device-pixel-ratio: 1.5) {}

If this turns out to be correct, perhaps the core browser is just being stricter than Chrome and requiring you to enter the exact value. 如果事实证明是正确的,则可能是核心浏览器比Chrome更严格,并要求您输入确切的值。

The following article has a bit more detail: http://developer.android.com/guide/webapps/targeting.html 以下文章更加详细: http : //developer.android.com/guide/webapps/targeting.html

I'm assuming the S3 uses hdpi graphics but if this is incorrect, the following Stack Overflow has a more complete list of pixel densities (Google's article is a little old so only goes up to hdpi): Android screen sizes in Pixels for ldpi, mdpi, hpdi? 我假设S3使用的是hdpi图形,但是如果这样做不正确,则以下Stack Overflow会提供更完整的像素密度列表(Google的文章有些陈旧,因此只能使用hdpi): Android屏幕尺寸(以像素为单位)为ldpi, mdpi,hpdi?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM