WebView in the lower right corner of the zoom button can not be removed
Settings.setdisplayzoomcontrols (false); Hide WebView Zoom button
let WebView load the page center display there are several ways I know
The first method:
WebSettings settings = Webview.getsettings ();
Settings.setlayoutalgorithm (layoutalgorithm. Single_column);
Layoutalgorithm is an enumeration used to control the layout of a page, with three types:
1.narrow_columns: If possible, the width of all columns does not exceed the screen width
2.NORMAL: Normal display does not make any rendering
3.single_column: Enlarge All content in a column webview equal width
With the Single_column type can set the page center display, the page can zoom in and out, but this method is not good, and sometimes make your page layout is out of shape and I measured, can only show the middle piece, beyond the screen can not be displayed.
The second method:
Set up the loaded page Adaptive phone screen
Settings.setusewideviewport (true);
Settings.setloadwithoverviewmode (TRUE);
The first method sets the WebView recommended window, set to True. The second method is to set the mode for WebView loaded pages and also set to true.
This method can make your page adapt to the resolution of the phone screen, complete display on the screen, you can zoom in and zoom out.
Both methods have been tried, the second method is recommended
Third method : (mainly for tablets, adjust the resolution for specific screen code)
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);
}
Blog Original: http://www.cnblogs.com/bluestorm/archive/2013/04/15/3021996.html