android h5支付成功停留在支付宝,Android H5调起原生微信或支付宝支付

public final class WebViewUtil{

/**

* 应用WebView的设置

webSettings.setDomStorageEnabled(true);//设置DOM Storage缓存

webSettings.setDatabaseEnabled(true);//设置可使用数据库

webSettings.setJavaScriptEnabled(true);//支持js脚本

webSettings.setUseWideViewPort(true);//将图片调整到适合webview的大小

webSettings.setSupportZoom(false);//支持缩放

webSettings.setBuiltInZoomControls(false);//支持缩放

webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL);//支持内容从新布局

webSettings.setSupportMultipleWindows(false);//多窗口

webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);//关闭webview中缓存

webSettings.setAllowFileAccess(true);//设置可以访问文件

webSettings.setNeedInitialFocus(true);//当webview调用requestFocus时为webview设置节点

webSettings.setJavaScriptCanOpenWindowsAutomatically(true);//支持通过JS打开新窗口

webSettings.setLoadsImagesAutomatically(true);//支持自动加载图片

webSettings.setGeolocationEnabled(true);//启用地理定位

webSettings.setAllowFileAccessFromFileURLs(true);//使用允许访问文件的urls

webSettings.setAllowUniversalAccessFromFileURLs(true);//使用允许访问文件的urls

*/

@SuppressLint("SetJavaScriptEnabled")

public static void webSettingsApply(WebSettings webSettings){

webSettings.setDomStorageEnabled(true);//设置DOM Storage缓存

webSettings.setDatabaseEnabled(true);//设置可使用数据库

webSettings.setJavaScriptEnabled(true);//支持js脚本

webSettings.setUseWideViewPort(true);//将图片调整到适合webview的大小

webSettings.setSupportZoom(false);//支持缩放

webSettings.setBuiltInZoomControls(false);//支持缩放

webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL);//支持内容从新布局

webSettings.setSupportMultipleWindows(false);//多窗口

webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);//关闭webview中缓存

webSettings.setAllowFileAccess(true);//设置可以访问文件

webSettings.setNeedInitialFocus(true);//当webview调用requestFocus时为webview设置节点

webSettings.setJavaScriptCanOpenWindowsAutomatically(true);//支持通过JS打开新窗口

webSettings.setLoadsImagesAutomatically(true);//支持自动加载图片N

webSettings.setGeolocationEnabled(true);//启用地理定位

if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {

webSettings.setAllowFileAccessFromFileURLs(true);//使用允许访问文件的urls

webSettings.setAllowUniversalAccessFromFileURLs(true);//使用允许访问文件的urls

}

if(Build.VERSION.SDK_INT >= 19) {

if(Configs.DEBUG){

WebView.setWebContentsDebuggingEnabled(true);

}

}

// webSettings.setRenderPriority(WebSettings.RenderPriority.NORMAL);//设置渲染优先级 will be Deprecated

}

/**

* webView 销毁webView避免内存泄漏

*/

public static  void destory(WebView webView){

if(webView != null){

webView.stopLoading();

webView.getSettings().setJavaScriptEnabled(false);

webView.clearHistory();

webView.removeAllViews();

webView.destroy();

}

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值