消息webView下载跳转自带浏览器,分享卡片修复图片混乱
This commit is contained in:
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
//设置加载进度条
|
||||
|
||||
Reference in New Issue
Block a user