android - 中国安卓设备。WebView 使用什么浏览器?
问题描述
中国默认不允许在中国安卓设备上安装谷歌Chrome浏览器,我们也不能要求使用它进行测试。我们注意到我们的 Hybrid 应用程序在中国设备上出现问题
在装有 Android 5+ 的中国设备中。
1.- WebView 组件与标准不同吗?
2.- WebView 使用什么渲染引擎和javascript引擎?WebKit 和 V8?
3.- 哪个中文浏览器的行为与 WebView/Chrome 最相似?
谢谢。
解决方案
多年来,我一直在使用中国 Android 设备。我的许多客户都拥有 ONDA 和 CUBE 平板设备,有时运行的版本可能与 4.2.2 一样旧,而且大多是 5.0+。这是一个很难的问题,因为有这么多的口味,当然他们没有谷歌播放服务。大多数这些设备上的 WebView 组件运行良好。渲染引擎似乎是 WebGL。以下是一些屏幕截图,显示了我使用的 ONDA 7" 平板电脑的浏览器详细信息。 这是我刚刚在我的一个 ONDA 7" 平板电脑上测试的代码,它运行良好
webView = (WebView) findViewById(R.id.wb_webview);
//Scroll bars should not be hidden
webView.setScrollbarFadingEnabled(false);
webView.setHorizontalScrollBarEnabled(true);
webView.setVerticalScrollBarEnabled(true);
webView.setFitsSystemWindows(true);
//Enable JavaScript
webView.getSettings().setJavaScriptEnabled(true);
//Set the user agent
webView.getSettings().setUserAgentString("AndroidWebView");
//Clear the cache
webView.clearCache(true);
webView.setBackgroundColor(Color.parseColor("#FFFFFF"));
webView.setFadingEdgeLength(10);
webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setDisplayZoomControls(false);
final Activity activity = this;
final ProgressDialog progressDialog = new ProgressDialog(activity);
//progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressDialog.setProgressStyle(ProgressDialog.THEME_HOLO_LIGHT);
progressDialog.setCancelable(true);
webView.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {
progressDialog.setCanceledOnTouchOutside(true);
progressDialog.setTitle("Loading visualization ...");
progressDialog.setButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
webView.destroy();
finish();
} });
progressDialog.show();
progressDialog.setProgress(0);
activity.setProgress(progress * 1000);
progressDialog.incrementProgressBy(progress);
if(progress == 100 && progressDialog.isShowing())
progressDialog.dismiss();
}
});
// Load the URL of the HTML file containing the JavaScript D3 code
webView.loadUrl("https://www.google.com");
推荐阅读
- tcl - proc完成后如何退出tcl代码
- rabbitmq - Spring Cloud Contract - 消息传递 - 生产者端合同验证期间的 NoSuchBeanDefinitionException
- reactjs - 如何在没有 webpack 配置的情况下通过 sharepoint 母版页调用 ReactJS 块文件
- javascript - 使用异步函数的DataMaps js问题
- ms-access - 打开新表单以添加客户订单
- c++ - 如何根据不同的专业设置内部模板类的特定成员?
- python - 如何在数据框中使用满足条件的另一列的解析值在数据框中创建新列
- laravel - 如何在laravel中拥有auth用户的角色名称
- git - 将被推送的 2 个提交是什么?
- css - 找不到自定义样式表 ASP.NET Core