Pregunta

Hey I'm trying to get pinch to zoom working on a Webview of my app but cant, it just displays the image really zoomed in (probably displaying it 100%)

here is how i got the webview to work.

In the activity I added

 WebView mWebView = (WebView) findViewById(R.id.webview);
 mWebView.getSettings().setJavaScriptEnabled(true);
 mWebView.loadUrl("file:///android_asset/sitemap.png");

The image is in the assets folder and is named sitemap.png

The layout xml I used for the webview is

<WebView  xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>

I have not added anything else to the code. Can you tell me what isnt working, as say it displays the picture perfectly but i cant pinch zoom, what is the easiest way to solve this as i am nooby

Cheers

¿Fue útil?

Solución

In API 3, you can use setBuiltInZoomControls:

webView.getSettings().setBuiltInZoomControls(true);

See Also: Disable pinch zoom in WebView?

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top