消息webView下载跳转自带浏览器,分享卡片修复图片混乱

This commit is contained in:
khy
2016-11-18 18:32:21 +08:00
parent 1917462ea3
commit 88bb8949dd
4 changed files with 42 additions and 17 deletions

View File

@ -1,8 +1,11 @@
package com.gh.gamecenter;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.DownloadListener;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
@ -33,6 +36,8 @@ public class WebActivity extends BaseActivity {
WebSettings settings = news_webview.getSettings();
settings.setJavaScriptEnabled(true);
settings.setSupportZoom(true);
settings.setBuiltInZoomControls(true);
//用webview打开url
news_webview.setWebViewClient(new WebViewClient(){
@ -41,6 +46,25 @@ public class WebActivity extends BaseActivity {
view.loadUrl(url);
return true;
}
// @Override
// public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
// 广告拦截操作
// if (!url.contains(xxxx)) {
// return new WebResourceResponse(null, null, null);
// }
// return null;
// }
});
// 页面里的下载跳转到自带浏览器
news_webview.setDownloadListener(new DownloadListener() {
@Override
public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
Uri uri = Uri.parse(url);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});
//设置加载进度条