webview常用设置
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB){
webview.setLayerType(View.LAYER_TYPE_SOFTWARE,null)
}
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
webview.setWebContentsDebuggingEnabled(true)
}
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN){
webview.getSettings().setAllowFileAccessFromFileURLs(true)
}
webview.getSettings().setUserAgentString(vname)
webview.getSettings().setJavaScriptEnable(true)
webview.getSettings().setDatabaseEnable(true)
webview.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL)
webview.getSettings().setLoadWithOverviewMode(true)
webview.getSettings().setUseWideViewPort(true)
webview.getSettings().setAppCachePath(getCacheDir().getPath())
webview.getSettings().setAppCacheEnable(true)
webview.getSettings().setJavaScriptCanOpenWindowsAutomatically(true)
webview.getSettings().setCacheMode(WebSetting.LOAD_CACHE_ELSE_NETWPRK)
webview.getSettings().setDomStorageEnabled(true)
webview.clearCache(true)
webview.setOnLongClickListener(new View.OnLongClickListener(){
public boolean onLongClick(View v){
return ture
}
}