本文介绍了有XWalkView webviewclient吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Android应用中使用 XWalkView 作为Webview的替代品.我注意到 XWalkView 对象上没有setWebViewClient方法.问题是我想检查页面何时完成(onPageFinished)和何时加载资源(onLoadResource).我该如何使用 XWalkView ?

I'm trying to use XWalkView as webview replacement in my android app. I noticed that there's no setWebViewClient method on XWalkView object. The thing is that I want to check when the page is finished (onPageFinished) and when the resource is loaded (onLoadResource). How can I do this with XWalkView?

我使用本教程嵌入了XWalkView

I embed the XWalkView using this tutorial

在Android Studio中嵌入人行横道

推荐答案

Cross Walk API为每个组件引入了自己的名称.不仅WebView重命名为XWalkView,而且WebViewClient的对应名称分别为XWalkResourceClientWebChromeClient-XWalkUIClient.因此,应该使用setResourceClient方法并将XWalkResourceClient实例传递给它,而不是setWebViewClient.在此对象中,您可以实现一些必需的方法,例如onLoadFinished.请查阅 Cross Walk API文档.

Cross Walk API introduces its own names for every component. Not only the WebView is renamed to XWalkView, but also WebViewClient has its counterpart named XWalkResourceClient and WebChromeClient - XWalkUIClient. So, instead of setWebViewClient you should use setResourceClient method and pass XWalkResourceClient instance to it. In this object you can implement some required methods, for example onLoadFinished. Please, consult with Cross Walk API documentation for further details.

这篇关于有XWalkView webviewclient吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-29 21:20