WebView自适应

WebSettings settings = wv_content.getSettings();
		
		DisplayMetrics metrics = new DisplayMetrics();
		getWindowManager().getDefaultDisplay().getMetrics(metrics);
		int mDensity = metrics.densityDpi;
		if (mDensity == 120) {
		settings.setDefaultZoom(ZoomDensity.CLOSE);
		}else if (mDensity == 160) {
		settings.setDefaultZoom(ZoomDensity.MEDIUM);
		}else if (mDensity == 240) {
		settings.setDefaultZoom(ZoomDensity.FAR);
		}


注:stackoverflow看到的

你可能感兴趣的:(android,webView)