AgentWeb的简单使用
2019-05-22 本文已影响0人
清风兑酒
大神的GitHub网址:https://github.com/Justson/AgentWeb
开始介入代码:
1.导入依赖:
api 'com.just.agentweb:agentweb:4.0.3-beta' // (必选)
api 'com.just.agentweb:filechooser:4.0.3-beta'// (可选)
api 'com.just.agentweb:download:4.0.3-beta' // (可选)
api 'com.github.Justson:Downloader:v4.0.3'// (可选)
2.相关的:
3.简单使用:
mAgentWeb = AgentWeb.with(this)
.setAgentWebParent((LinearLayout) view, new LinearLayout.LayoutParams(-1, -1))
.useDefaultIndicator()
.createAgentWeb()
.ready()
.go("http://www.jd.com");
4.介入:
//获取网页的标题
mAgentWeb.getWebCreator().getWebView().setWebChromeClient(new WebChromeClient() {
@Override
public void onReceivedTitle(WebView view, String title) {
if (!TextUtils.isEmpty(title)) {
newTitle = title;
mTvTool.setText(title);
}
super.onReceivedTitle(view, title);
}
});