Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android webview pinch zoom local image

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

like image 392
Tim Hannah Avatar asked Aug 20 '11 17:08

Tim Hannah


1 Answers

In API 3, you can use setBuiltInZoomControls:

webView.getSettings().setBuiltInZoomControls(true);

See Also: Disable pinch zoom in WebView?

like image 60
Phil Avatar answered Nov 06 '22 17:11

Phil