Code example for WebView

Methods: getScalegetSettings, setHorizontalScrollBarEnabled

0
 
	@Override 
	public void setWebView(WebView web, DisplayMetrics metrics) {
		log.debug("setWebView()...");
		if (web != null) {
			WebSettings settings = web.getSettings();
			settings.setJavaScriptEnabled(true);
			settings.setJavaScriptCanOpenWindowsAutomatically(false);
			settings.setSaveFormData(true);
			settings.setSavePassword(true);
			settings.setBuiltInZoomControls(true);
			// Some site check UA, if use custom, site will show bad, so comment this 
			// If you want replace default Usage-Agent field, use this. 
			// settings.setUserAgentString("Gorilla/Android HWAndroid/0.1"); 
			settings.setAllowFileAccess(true);
			settings.setDefaultZoom(WebSettings.ZoomDensity.FAR);
			settings.setNeedInitialFocus(false);
			settings.setRenderPriority(WebSettings.RenderPriority.HIGH);
			web.setHorizontalScrollBarEnabled(false);
			if(log.isDebug()) {
				web.addJavascriptInterface(new InJavaScriptLocalObj(), "local_obj");
			} 
			log.debug("WebView default scale: " + web.getScale());
		} 
 
	} 
 
	@Override 
Stop searching for code, let great code find you!  Add Codota to your java IDE