简体   繁体   English

为什么我的网站在Android模拟器和设备上看起来有所不同?

[英]Why does my website look different in Android emulator and on devices?

I have built a website (no link for the moment). 我已经建立了一个网站(暂时没有链接)。 Said website is responsive and generally works well across most modern devices. 该网站具有响应能力,通常可在大多数现代设备上正常运行。 It helps that the only really modern CSS features I am using are "transition," "transform," and "box-sizing." 我使用的唯一真正现代的CSS功能是“转换”,“变换”和“框大小”,这有帮助。 They are generally used in both prefixed and unprefixed forms. 它们通常以前缀和非前缀形式使用。

Now, since I don't have a bazillion Android devices here, I thought I'd try the website in the Android Emulator offered with the Android SDK. 现在,由于我这里没有大量的Android设备,因此我想尝试使用Android SDK提供的Android Emulator中的网站。 At that point, I was a bit shocked to find that it was rather broken in everything below 4.3. 那时,我很震惊地发现它在4.3以下的所有版本中都被破坏了。

The issue seems to be that my menu implementation uses "transform: translate();" 问题似乎是我的菜单实现使用了“ transform:translate();”。 and that the Android stock browser apparently does not support this property. 而且Android股票浏览器显然不支持此属性。

I noticed that Google seems to use the same WebKit version (534.30) in the emulator images for Android 4.0, 4.1, 4.2, and 4.3. 我注意到Google在Android 4.0、4.1、4.2和4.3的仿真器映像中似乎使用了相同的WebKit版本(534.30)。 (If I can trust the user agent string.) (如果我可以信任用户代理字符串。)

In the Android 4.4 and above emulator images,everything works as expected. 在Android 4.4及更高版本的模拟器映像中,一切正常。 Android 4.4 is also the first version to use a WebView implementation based on Chrome (version 33). Android 4.4也是第一个使用基于Chrome的WebView实现的版本(版本33)。

My own Android device (from Sony) runs on Android 4.3. 我自己的Android设备(来自Sony)在Android 4.3上运行。 According to the user agent string, the WebView's WebKit version there is also 534.30. 根据用户代理字符串,WebView的WebKit版本也为534.30。 I tried my website in a browser that uses WebView (Lightning browser from F-Droid). 我在使用WebView(F-Droid的Lightning浏览器)的浏览器中尝试了我的网站。 And it worked, including animations. 它起作用了,包括动画。

A colleague also opened my web page on his Samsung device with Android 4.0. 一位同事还在他的Android 4.0三星设备上打开了我的网页。 It worked there too. 它也在那里工作。 (Haven't checked the user agent there.) (尚未在此处检查用户代理。)

So, I thought, maybe Google updates WebView via Play Services. 因此,我想,也许Google通过Play服务更新了WebView。 To the best of my understanding, that does not seem to be the case: I disabled the Play Services app, deleted its data, rebooted the phone. 据我所知,事实并非如此:我禁用了Play Services应用,删除了其数据,重新启动了手机。 The page still worked. 该页面仍然有效。

What is going on? 到底是怎么回事? Are manufacturers wildly patching WebKit? 制造商是否正在疯狂修补WebKit? Can I trust the WebKit version number at all? 我可以完全信任WebKit版本号吗?

(Updated to clarify the actual issue.) (已更新以澄清实际问题。)

Check the screensize. 检查屏幕尺寸。 the emulators always have different screen size. 模拟器始终具有不同的屏幕尺寸。 that may be the issue. 这可能是问题所在。

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

相关问题 为什么我的Android模拟器和Android手机在设备密度和DPI上给我不同的结果? - Why does my android emulator, and my android phone give me different results for a devices density and DPI? 为什么我的应用在设计模式和仿真器上看起来不同? - Why does my app look different on design mode and emulator? 为什么我的Android程序在某些设备上看起来放大了? - Why does my android program look zoomed in on some devices? 为什么Netbeans无法与我的Android模拟器设备通信? - Why is Netbeans not communicating with my android emulator devices? 为什么我的Android Studio预览看起来不同? - Why does my Android studio preview look different? 为什么设计看起来与 android studio 模拟器中显示的不同? - Why does the design look different than what's shown in emulator in android studio? 为什么我的 Flutter 应用程序在 IOS 模拟器上看起来很好,但在 Android 上却溢出了? - Why does my Flutter app look fine on the IOS emulator but overflow on Android? 为什么我的应用在模拟器中看起来不错,但在手机上却不行? - Why does my App look good in Emulator but not on the phone? 为什么我的listPreference对话框看起来不同? - Why does my listPreference dialog look different? 为什么我的启动器图标看起来不同? - Why does my launcher icon look different?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM