问题描述
我正在尝试在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
推荐答案
Cross Walk API为每个组件引入了自己的名称.不仅WebView
重命名为XWalkView
,而且WebViewClient
的对应名称分别为XWalkResourceClient
和WebChromeClient
-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吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!