Home  >  Article  >  Backend Development  >  android webview 嵌入网页

android webview 嵌入网页

WBOY
WBOYOriginal
2016-06-06 20:29:281449browse

android 使用webview 嵌入网页

网页里面a标签进行apk下载
结果发现点击手机屏幕无响应
用浏览器访问是可以正常触发下载的

请问哪位大侠有遇到过类似情况的
求解~~~

回复内容:

android 使用webview 嵌入网页

网页里面a标签进行apk下载
结果发现点击手机屏幕无响应
用浏览器访问是可以正常触发下载的

请问哪位大侠有遇到过类似情况的
求解~~~

webview 的下载要自己实现,webView.setDownloadListener 通过这个得到下载事件,处理下载逻辑

如果只有一个链接可以这么做:

webView.setWebViewClient(new WebViewClient() {
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                download(url);
                return true;
            }
        });
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn