int screenDensity = getResources().getDisplayMetrics().densityDpi;
WebSettings.ZoomDensity zoomDensity = WebSettings.ZoomDensity.MEDIUM ;
switch (screenDensity){
case DisplayMetrics.DENSITY_LOW :
zoomDensity = WebSettings.ZoomDensity.CLOSE;
break;
case DisplayMetrics.DENSITY_MEDIUM:
zoomDensity = WebSettings.ZoomDensity.MEDIUM;
break;
case DisplayMetrics.DENSITY_HIGH:
zoomDensity = WebSettings.ZoomDensity.FAR;
break ;
case DisplayMetrics.DENSITY_XHIGH:
zoomDensity = WebSettings.ZoomDensity.FAR;
break ;
}
myWebView.getSettings().setDefaultZoom(zoomDensity);
WebSettings.ZoomDensity zoomDensity = WebSettings.ZoomDensity.MEDIUM ;
switch (screenDensity){
case DisplayMetrics.DENSITY_LOW :
zoomDensity = WebSettings.ZoomDensity.CLOSE;
break;
case DisplayMetrics.DENSITY_MEDIUM:
zoomDensity = WebSettings.ZoomDensity.MEDIUM;
break;
case DisplayMetrics.DENSITY_HIGH:
zoomDensity = WebSettings.ZoomDensity.FAR;
break ;
case DisplayMetrics.DENSITY_XHIGH:
zoomDensity = WebSettings.ZoomDensity.FAR;
break ;
}
myWebView.getSettings().setDefaultZoom(zoomDensity);