My application has an activity which loads a page viewer. Each page view is inflating a new fragment. Inside each fragment is a webview.
I've been following everything on Stack and google trying to resolve this.
Inside my onCreateView I'm using this code:
WebSettings wb = mWebview.getSettings();
wb.setSupportZoom(true);
wb.getBuiltInZoomControls();
wb.setDisplayZoomControls(true);
wb.setJavaScriptEnabled(true);
mWebview.setWebChromeClient(new mWebChromeClient());
mWebview.setWebViewClient(new mWebViewClient());
mWebview.loadUrl(url);
None of this works however, when I remove it and simply use this mWebview.getSettings().setDefaultZoom(WebSettings.ZoomDensity.FAR); setDefaultzoom does infact zoomout, but not pinch and zoom.
My xml layout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:orientation="vertical">
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent">
</WebView>
</RelativeLayout>
Overall everything is nice, except I hate not being able to pinch and zoom.
Finally! Thank you everyone!
Blogger.com (And I guess the other sites as well) have the viewport disabled for users.
In blogger there is HTML code preventing my site from zooming.
b:if cond='data:blog.isMobile'>
meta content='width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0' name='viewport'/>
By changing maximum-scale=1.0 to maximum-scale=2.0 I was to finally see zoomcontrols.
Also, here is my code for the zoomControls
this.mWebView.setWebChromeClient(new mWebChromeClient());
this.mWebView.setWebViewClient(new mWebViewClient());
this.mWebView.loadUrl(url);
this.mWebView.getSettings().setJavaScriptEnabled(true);
this.mWebView.getSettings().setSupportZoom(true);
this.mWebView.getSettings().setBuiltInZoomControls(true);