Android 网络视图渲染看起来与 chrome 不同

Android webview rendering looks different to chrome

我用 webview 构建了一个浏览器,它仍在开发中。在 activity 中添加了一个 webview 之后,我只是简单地完成了 "webview client" 之类的事情,然后我使用了 loadURL("http://www.google.com")(除了约束之外,我没有更改任何默认属性),但是页面的外观看起来很奇怪。

但是 Google 说 webview 使用与 chrome 相同的引擎。我想知道我是否应该启用某些功能,或者这就是 webview 呈现 HTML 页面的方式。

这是它的样子:

一些因素可能会导致此行为,一个是 API 的版本,即 运行 其 WebView 检查 API 的版本。但某些设置可以帮助解决此问题,例如:

myWebView.webViewClient = WebViewClient()
myWebView.settings.setAppCacheEnabled (true)
myWebView.settings.javaScriptEnabled = true
myWebView.settings.loadWithOverviewMode = true 
myWebView.settings.allowFileAccess = true
myWebView.settings.allowContentAccess = true