WebView : Handle web link click internaly and enable zooming
rutura edited this page Apr 16, 2017
·
1 revision
- MinSdk : 1
- The default behaviour of the webview is to pass the the click events to the default browser on your device
- This is because there is no web client attached to the webview by default
- Change that by attaching your own web client as shown below:
webview.setWebViewClient(new WebViewClient());
- Add zooming capabilities to the webview as follows:
webview.getSettings().setBuiltInZoomControls(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
//Android 3.0+ has pinch-zoom, don't need buttons
webview.getSettings().setDisplayZoomControls(false);
}