Android WebView网页自适应手机,可放大缩小设置代码

webView = (WebView) findViewById(R.id.project_guquan_details_webview);
		
		WebSettings webSettings = webView.getSettings();
	    webSettings.setSupportZoom(true);
	    webSettings.setJavaScriptEnabled(true);
	    webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
	    webSettings.setBuiltInZoomControls(true);//support zoom
	    //webSettings.setPluginsEnabled(true);//support flash
	    webSettings.setUseWideViewPort(true);// 这个很关键
	    webSettings.setLoadWithOverviewMode(true);
		
		webView.loadUrl(Default.ip + "/Cache/Runtime/" + id + ".html");

你可能感兴趣的:(学习笔记)