开发者

Android webview pinch zoom local image

开发者 https://www.devze.com 2023-03-29 18:16 出处:网络
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%)

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


In API 3, you can use setBuiltInZoomControls:

webView.getSettings().setBuiltInZoomControls(true);

See Also: Disable pinch zoom in WebView?

0

精彩评论

暂无评论...
验证码 换一张
取 消