Android 网络浏览器分辨率有什么关系?
这是同一部 Android 手机的两张图片,一张是纵向模式,一张是横向模式。
一种分辨率不应该与另一种分辨率相反吗?即如果一个是800x1360,另一个应该是1360x800?这是怎么回事?如果我在 iPod touch 上尝试同样的操作,无论方向如何,它都会报告相同的分辨率。此外,在 Android 手机上,当您放大和缩小或滚动页面时,分辨率似乎会发生变化。
我试图弄清楚如何在 CSS 中处理 Android 手机的“报告”分辨率,除非我确切地知道它报告的分辨率,否则我无法做到这一点。 :(
Here are two images of the same android phone, once in Portrait mode, once in Landscape mode.
Shouldn't one resolution be the opposite of the other? I.e. if one is 800x1360, the other should be 1360x800? What's going on here? If I try the same thing on my ipod touch, it reports the same resolution regardless of orientation. Also, on the android phone, the resolution appears to change as you zoom in and out or scroll around the page.
I'm trying to figure out how to handle the "reported" resolution of an android phone in CSS, which I can't do until I know exactly which resolution it reports. :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,浏览器假设您将根据需要重新调整页面大小,因此无论实际屏幕尺寸和方向如何,它总是报告相同的宽度。大概只是选择了高度,以便长宽比与实际屏幕比例相匹配。
如果您运行 FroYo,则宽度几乎总是报告为 800。我相信 Eclair 更像是 640,并且早期版本可能使用完全不同的方案来报告屏幕尺寸。 (我相信,这些早期版本也支持“@media手持设备”,与后来的版本不同,后者假设您的手机屏幕/浏览器比传统手持设备更接近桌面。)
As far as I can determine, the browser assumes that you are going to let it rescale the page as necessary, so it just always reports the same width no matter the actual screen size and orientation. The height is presumably just chosen so that the aspect ratio matches the actual screen ratio.
If you are running FroYo, the width is pretty much always reported as 800. I believe that it was more like 640 for Eclair, and that earlier versions may have used a completely different scheme for reporting screen size. (Those earlier versions also, I believe, supported "@media handheld", unlike later versions which assume that your phone screen/browser is closer to a desktop than a traditional handheld device.)
我注意到一个奇怪的事情,像这样的尺寸是从上一个窗口/会话存储的。当您转到横向/纵向并获得 rez 时,进行刷新,看看您是否获得另一个不同的 rez。
缩放也是如此。
我的建议是进行用户代理查找并专门为移动设备创建一个页面。
渲染正常的“桌面”站点是行不通的。
如果你确实让移动网站查看 html 元标记“Viewport”并将类似的内容放入你的脑海中
I've noticed a weird thing where dimensions like this are stored from the previous window/session. When u go to landscape/portrait and get the rez, do a refresh, see if u get another different rez.
Same is true for scaling.
My advice is do a useragent lookup and make a page specifically for mobile devices.
rendering the normal 'desktop' site just wont work.
if you do make the mobile site look at the html meta tage "Viewport" and put something like this in your head